This question already has an answer here:
- How do I compare strings in Java? 23 answers
Scanner keyboard = new Scanner(System.in);
String input = keyboard.next();
System.out.println(input == "+");
How come the print statement prints false if the user enters "+"?
Aucun commentaire:
Enregistrer un commentaire