LoslegenKostenlos loslegen

Email checking

You want to check email addresses. As email addresses always have to contain at least one @ character and a . afterwards, you can check this with a two-part logical expression.

Diese Übung ist Teil des Kurses

Intermediate Java

Kurs anzeigen

Anleitung zur Übung

  • Choose the correct logical operator to put in the logical expression.

Interaktive Übung

Vervollständige den Beispielcode, um diese Übung erfolgreich abzuschließen.

class EMailChecker {
  public static void main(String[] args) {
    String address = "[email protected]";
    int addLen = address.length();

    // Write the correct logical operator to make sure the address is valid
    if (address.contains("@") ____ address.charAt(addLen - 4) == '.') {
      System.out.println("Send that email !");
    } else {
      System.out.println("That's not a valid email");
    }
  }
}
Code bearbeiten und ausführen