//Program to demonstrate the NullPointerException.
//Solution :
class nullexcep
{
public static void main(String args[ ] )
{
int a[]=null;
int b;
try{
b=a[1];//null pointer
}
catch(ArithmeticException e)
{
System.out.println(e.Message());
}
catch(NullPointerException e1)
{
System.out.println(“NullPointerException” +e1);
}
catch(Exception e)
{
System.out.println(“Error”);
}
}
}
SiteMap
|
Link Us
...Language...
English
French
German
Hindi
Italian
Russian
Japanese
Chinese
Home
|
About Us
|
Portfolio
|
Services
|
Courses
|
Career
|
Cost
|
Contact Us
Services
SEO
Link Building
Data Entry
Web Design and development
Web Application development
Graphic and multimedia
E-Commerce Solutions
Software development
Web Marketing & Promoting
Internet Marketing
IT Outsourcing
Multimedia/CD Presentation
Synopsis Ideas
Project Ideas
Placement Papers
Live Project Training
Programming & Projects
Faq
Training @balujalabs
Method
To demonstrate the use of Null pointer Exception.
1
To demonstrate the use of negative size Array exception
2
To demonstrate the use of arithmetic exception.
3
To demonstrate the use of multiple catch.
4
To demonstrate the use of Array index out Bounds Exception.
5
To demonstrate the use of string index out of bound exception.
6
To demonstrate the use of Null pointer Exception.