class ExceptionHandling
{
    public static void main(String[] args)
    {
        System.out.println("This statement will be executed"); 
 
        String s = null;
 
        try
        {
            System.out.println(s.length());  //This statement throws NullPointerException
        }
        catch (Exception e)
        {
            System.out.println("Exception Caught");
        }
 
        System.out.println("Now, This statement will also be executed");
    }
}

Create NullPtrExp.java