If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Two things. First, what you should use for checking String equality is:

Code:

if (stringname.equals("value")) {
// stuff!
}

If you use the == operator, it actually compares the address of the String objects which isn't what you want.

Second, using a single = means assignment. So in your original if statement, it sets the variable stringname's value to "value", and the if statement evaluates to true because it was successful. A little wierd I know.

When doing a compare, use two ==. Here is how an if comparing two ints would look: