+ 1
Why does it turn every time to the "else" clause?
Maybe the if statement is false but i'm not sure pls help The output us everytime "nope! try again" even if the answers are correct Answers: 24 berlin java https://code.sololearn.com/c8qU92phJIvs/?ref=app
3 Respostas
+ 2
Here. A couple of things:
To compare Strings use .equals(). string1.equals(string2)
Now, to get the word you are better off using .next() instead of nextLine()
https://code.sololearn.com/cdZKJ34HTEmd/?ref=app
+ 2
ahhh thank you very much! I havd been desperate for hours 😂😂
+ 1
For checking string equality, you use .equals or .equalsIgnoreCase..
Like String s ="a" , s1 = "A";
if(s.equals(s1)) // false
If you want to ignore the case you do.
if(s.equalsIgnoreCase(s1)) // true
Replace the == with .equals or .equalsIgnoreCase in case of Strings