10/25/2012

Null Pointer Exception in String variable

when you Found "Null Pointer Exception "
then check your variable value whether is having some value or not
If the eg: String contain null
& we calling any String method .equals() or .trim()
then error Message is Shown Two conditions need to check




String name="";

If(name!==null && !"".equals(name))

{

//your code goes Here
}

This Check Is Necessary


It is simple but some time it will waste your time.
In Big Line Of Codes

2 comments: