New Member FAQ | Forums | Earn Revenue


Resources Entrance Ask Experts Exam Papers Jobs English Projects Universities Colleges Courses Schools Training My India



My Profile
Active Members
TodayLast 7 Days more...



Awards & Gifts
Online Exams

Fresher Jobs


Our fresher job section is exclusively for fresh graduates! Find jobs for freshers in major Indian cities including Bangalore, Chennai, Hyderabad, Pune or Kochi

Resources


Find educational articles, blogs, discussion threads and other resources.

Colleges


Find details about any college in India or search for courses.

website counter



Example program for Null Pointer Exception - Java


Posted Date:     Total Responses: 0    Posted By: Annapurna   Member Level: Gold   Points/Cash: 2   


public class TestRef {

public TestRef () {
System.out.println("tr");
return ;
}

public void print () {
System.out.println ("Instance") ;
}

public static void sprint () {
System.out.println ("Class") ;
}

public static void main(String arfs [ ]) {
System.out.println("1");
TestRef t1 = null ;
System.out.println("2");
TestRef t2 = new TestRef() ;
System.out.println("3");
t1.sprint() ; //this wont throw any null pointer exception because sprint() is static.
System.out.println("4");
t1.print() ; //this will throw null pointer exception
System.out.println("5");
t2.sprint() ;
System.out.println("6");
t2.print() ;
}
}


Project Feedbacks


No feedbacks found. Be the first to respond and make money from revenue sharing program.

Post Feedback
You must Sign In to post a feedback.
Next Project: Writing into file - Java
Previous Project: Passing values - Java

Return to Project Index

Post New Project


Related Projects



Advertise Here





Contact Us   Advertise   Editors    Privacy Policy    Terms Of Use   

ISC Technologies.
2006 - 2009 All Rights Reserved.