Comparing Strings not Working in Java -


this question has answer here:

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!"); } 

refer here more info


Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -