}else if( !(question.equals("a") || question.equals("b")) {
System.out.println("Sorry that isn't an A or a B");
You cannot do NOT equals a OR b
you must doNOT(equals a OR equals b)
Secondly, you are comparing strings with !=, but you must compare strings using the method. equals(String). This has been said millions of times, but: ==and !=compare object references, while .equals(String)comparing String values.
source
share