This question already has an answer here:
- How do I compare strings in Java? 23 answers
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