Quote:
Originally Posted by euhlmann
You may be running into a Java subtlety here.
Code:
boolean eq = ("abc" == "abc");
System.out.println(eq); // false!
I'm not entirely sure, but it may be the same problem in your switch statement. Try using String.equals in an if-else instead.
Otherwise, use the debugger to verify that sentence contains the "a" or "b" you need.
|
That looks ok to me. Take a look at this Oracle document:
https://docs.oracle.com/javase/8/doc...gs-switch.html