Possible Duplicates:
Gracefully avoiding NullPointerException in Java
Multilingual fields in DB tablesExact duplicate
http://stackoverflow.com/questions/963936/gracefully-avoiding-nullpointerexception-in-java
What do you like more? I just hate seeing the last one. It just seems backwards.
String randomtext = "stack overflow";
if(randomtext.equals("stack overflow"))
{
//do something
}
or
String randomtext = "stack overflow";
if("stack overflow".equals(randomtext))
{
//do something
}