Java

Java - Exceptio Handling(NullPointerException)

Java - Exceptio Handling(NullPointerException)
//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"); 
} 
} 
}
Senthilvelan Sambamoorthy

Senthilvelan Sambamoorthy is working as a Professor in Department of Master of Computer Applications, Paavai Engineering College, Namakkal, Tamilnadu, India, He is Masters in Computers Applications. Having 18+ years of experience and his area of interest is Java, JSP, Servlet, J2EE, C#, PHP, Python ASP.NET, SQL Server and etc.