1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
jeyben [28]
3 years ago
5

Write a method, isEmailAddress, that is passed a String argument. It returns true or false depending on whether the argument has

the form of an email address. In this exercise, assume that an email address has one and only one "@" sign and no spaces, tabs or newline characters.
Computers and Technology
1 answer:
Pavel [41]3 years ago
8 0

Answer:

//Method declaration taking a parameter called myString of type String

public static boolean isEmailAddress (String myString){

//checking the @ character exists in string

if (myString.indexOf("@") != -1) {

  //checking if only one instance of @ exist in the string

   if (myString.indexOf("@") == myString.lastIndexOf("@")) {

   //checking if there's no space character

  if (myString.indexOf(" ") == -1) {

    //checking if there's no newline character in the string

    if (myString.indexOf("\n") == -1) {

      // checking if there's no tab character in the string

      if (myString.indexOf("\t") == -1) {

          return true;

      }

    }

  }

}

}

 return false;

}

Explanation:

The method takes in a string which is supposed to be an email address and checks if it is a valid email, it returns true if it is a valid email and returns false if not. the method checks the following conditions along the way.

->If "@" exists

->If there's only one "@" in the string

->If space character does not exists

->If newline character does not exists

->If tab character does not exist

it returns true if all the conditions are true.

You might be interested in
Select the term below which is a protocol that provides a method for software components to communicate, interact, and share dat
KATRIN_1 [288]

Answer:

B. Application programming interface

Explanation:

An application programming interface (API) is an interface or communication protocol between different parts of a computer program intended to simplify the implementation and maintenance of software. An API may be for a web-based system, operating system, database system, computer hardware, or software library.

8 0
3 years ago
In Outlook 2016, the Tell Me function can be accessed by
guapka [62]

In Outlook 2016, the Tell Me function can be accessed by

O pressing F1 on the keyboard.

clicking on the File tab, then the question mark button.

typing a query in the textbox on the ribbon.

typing "help" in the search box in the message pane.

Explanation:

I think it should be typing a query in the textbox on the ribbon.

6 0
3 years ago
Read 2 more answers
Help please , I'm marking the brainliest
NNADVOKAT [17]

Answer:

Not sure about the first one

Second is False

Third is True

I think four is False

Five is Decor

6 is Content Page

Explanation:

8 0
2 years ago
Jak mogę usunąć swoje konto?
frez [133]

Answer: Jeśli przejdziesz do ustawień i prywatności

3 0
3 years ago
Read 2 more answers
Whats the main idea in Teenagers are rewriting the rules of the news???
melomori [17]
I can’t click on the article for some reason?
6 0
3 years ago
Other questions:
  • Dave has to create animations for a game. Which tool can Dave use?
    9·2 answers
  • Max magnitude Write a method maxMagnitude() with two integer input parameters that returns the largest magnitude value. Use the
    13·1 answer
  • How do you change a Word document to an .html file? Save it as a Web page. Save it as a plain text document. Copy it in rich tex
    14·1 answer
  • A number of related records that are treated as a unit is called
    6·1 answer
  • What are the best 3 xbox 360 games ?​
    10·2 answers
  • (choose one) Which is the proper means to decrement the integer variable, myScore, by one?
    15·1 answer
  • Brad is joining a big website design firm. He is worried that he may not be able to adapt to the company culture. What can he do
    15·1 answer
  • What is a project?
    5·2 answers
  • 1-5. Discuss briefly the function and benefits of computer network. (5pts​
    8·1 answer
  • To call the superclass's no-parameter constructor explicitly, use super(); group of answer choices true false
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!