I have a simple if statement that doesn’t seem to work. I’m out of ideas. I don’t understand why my logic is wrong.
String a = "bf";
if (a.compareTo("bf"))
{
// do this
}
I’m getting a redline under the compareTo statement.
Type mismatch: cannot convert from int to boolean
compareTomethod returns int value. so do as(or)
use
.equalsmethod