+ 1

Tell me the error in my code.why its not working properly?

I want that when user inputs hello or Hello then the result must be hello there but its printing the else statement.why? What is the error? https://code.sololearn.com/c4V143m9Di6i/?ref=app

20th Mar 2019, 9:14 AM
Vansh
6 Antworten
+ 4
In Java, we use String#equals(String) method to check String equality. == Operator is not used in case of Strings So, use this: input.equals("hello") || input.equals("Hello") After doing that, your code will work fine. Cheers! 😉
20th Mar 2019, 9:32 AM
Letsintegreat
Letsintegreat - avatar
+ 3
Vansh Pleased to help you 😋
20th Mar 2019, 10:18 AM
Letsintegreat
Letsintegreat - avatar
+ 2
Thank you so much Zlytherin
20th Mar 2019, 10:12 AM
Vansh
+ 2
Thank you ~ swim ~
20th Mar 2019, 10:13 AM
Vansh