vendredi 29 novembre 2019

Does input nextLine return String in JAVA? the problem is in following: [duplicate]

This question already has an answer here:

Code sample:

Scanner input = new Scanner(System.in);
System.out.print("Input Language: ");
String language = input.nextLine();

if (language == "en") {  
    System.out.println("en");
}

The problem is if statement never gets checked and I don't understand why Can anybody help the beginner programmer? Thanks

Aucun commentaire:

Enregistrer un commentaire