This is an assignment operator.
verifyFirstName = "Yes"
It's not checking to see if verifyFirstName
is equal to "Yes", it's setting it equal to "Yes".
You get the error "incompatible type" because the if
statement expects something that evaluates to a boolean true
or false
. The assignment you put in parentheses evaluates to a String. You need to compare your String values with the equals
method.
if (verifyFirstName.equals("Yes")) {
...
}