0
i cant match string characters and get the desired output. If user types Yes then also if statement gets skipped to else. Why?
2 Answers
+ 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"))