0

What is wrong with my java code?

try entering "Big Big Big" https://code.sololearn.com/cDvj21GrYWnj/?ref=app

21st Dec 2019, 4:57 AM
CASOY
CASOY - avatar
4 Réponses
+ 5
s == "Big" will return false since it is generally used for reference checking. Use s.equals("Big") inside the if statement to check for matching content and not reference.
21st Dec 2019, 5:14 AM
Avinesh
Avinesh - avatar
+ 2
Use equals method from String class for comapring Strings instead of ==
21st Dec 2019, 11:26 AM
Abdol Hashimi
Abdol Hashimi - avatar
+ 1
Note also the diferrence between lower and upper case. "big".equals("Big") returns false. "big".equalsIgnoreCase("Big") returns true.
21st Dec 2019, 9:41 AM
Denise Roßberg
Denise Roßberg - avatar
+ 1
Thanks a lot.
21st Dec 2019, 11:15 AM
CASOY
CASOY - avatar