vendredi 25 décembre 2015

If & scanner problemm

Why these codes don't work correctly? I used else if code with scanner but when you inter correct value don't work. Please help.

import java.util.Scanner;

class FirstProgram {

public static void main(String[] args) {
    Scanner KeyboardInput = new Scanner(System.in);

if (KeyboardInput.nextDouble() == 19 || KeyboardInput.nextLine() == "Moon"){
    System.out.println("Informations are true");
}else if(KeyboardInput.nextDouble() == 4.5 || KeyboardInput.nextLine() == "Jame"){
    System.out.println("Your acount was deleted!");
}else {
    System.out.println("Re-enter your information");
}

}
}

Aucun commentaire:

Enregistrer un commentaire