This question already has an answer here:
- How do I compare strings in Java? 23 answers
String whichPlane=kbReader.next();
System.out.println(whichPlane);
boolean plane=(whichPlane=="Airbus_A380");
System.out.println(plane);
output: Airbus_A380
false Why am i getting false?? i am not trying to compare it, i just want to check if the input is the same and if it is i want to go into that if statement.
Aucun commentaire:
Enregistrer un commentaire