0

i cant match string characters and get the desired output. If user types Yes then also if statement gets skipped to else. Why?

https://code.sololearn.com/cf4yJ92sBOrA/?ref=app

9th Jul 2017, 1:32 AM
Rajesh Nayak
Rajesh Nayak - avatar
2 ответов
+ 9
Strings are objects, and an object can only be equal to itself. So the nextLine() String and the String in the condition are different objects. String inputs must be compared like this: if (a.equals("Yes"))
9th Jul 2017, 1:39 AM
Tamra
Tamra - avatar