//NullPointerException
class NullEx
{
public static void main(String args[])
{
try
{
String str=null;
System.out.println(str.length());
}
catch(NullPointerException e)
{
System.out.println("\nNullPointerException : String is not declared");
}
}
}In this Program, easy to understand NullPointerException program in Java.
