Comparing Strings not Working in Java -
this question has answer here:
- how compare strings in java? 23 answers
i'm importing string file , string "computer_made". if execute code, though, not print "the computer made!" ideas?
if (data=="computer_made") { computer=true; system.out.println("the computer made!"); }
you should use .equals string comparison!!
if (data.equals("computer_made")) { computer=true; system.out.println("the computer made!"); }
Comments
Post a Comment