+ 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
6 Respuestas
+ 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! 😉
+ 3
Vansh Pleased to help you 😋
+ 2
Thank you so much Zlytherin
+ 2
Thank you ~ swim ~