Monday 9 December 2013

string is null or empty check in java

string null check in java

If we want to check weather string is empty or not then use the

String  str ="null";

if(str != null && !str.isEmpty())
{
 sysout("null");
}
else{
 sysout("not null");

}

No comments:

Post a Comment