previous |
start |
next
String Comparison
- Don't use == for strings!
if (input == "Y") // WRONG!!!
- Use equals method:
if (input.equals("Y"))
- == tests identity, equals tests equal contents
- Case insensitive test ("Y" or "y")
if (input.equalsIgnoreCase("Y"))
previous |
start |
next