jeudi 3 novembre 2016

if statement not working when the string are the same [duplicate]

This question already has an answer here:

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