1public class MyClass{
2private Object iAmNowNull;//This is null by default
3 private Object iAmInitialized=new Object();
4 public void test(){
5 System.out.println(iAmInitialized.toString());//prints that object
6 System.out.println(iAmNull.toString());//throws a NullPointerException
7}
1public class MyClass{
2 private Object iAmNull;//This is null by default
3 private Object iAmInitialized=new Object();
4 public void test(){
5 System.out.println(iAmInitialized.toString());//prints that object
6 System.out.println(iAmNull.toString());//throws a NullPointerException
7 }
8}