Java Help please? What is the opposite of .equals()?

Ok, here’s the thing.

equals is a boolean method which either returns true or false
and you should use like this for ignoring the letter case
while(grade.equalsIgnoreCase(“Z”)){
}

What you write is 99% correct, just negate the expression.
while ( ! grade.equalsIgnoreCase(“Z”))
Using the .equalsIgnoreCase() will shorten the code and its the same as what you type.

Just say,
if(grade.equals(“Z”) == false)

Leave a Comment