+ 2
Y is the if condition not getting exceuted in this java code..its jumping off to the else statement.
In this code, if the user inputs "java".. The code should execute the if statement.. but even if the user inputs " java" in this code..it executes the else statement.. pls help.#bug https://code.sololearn.com/cb6BP2AVt59Q/?ref=app
4 Respuestas
+ 2
a.equals("java")
== will check to see if they are the same String object not the same String value.
+ 4
== does not compare the actual values
+ 4
thanks a ton guys ...fixed it!!!..I'm lovin java..
+ 3
u cant compare strings with an == operator so use 'equals' operation to compare strings