class Eco {
public static void main(
String[] args) {
Eco e1 = new Eco();
Eco e2 = new Eco();
Eco e3 = new Eco();
e3.e = e2;
e1.e = e3;
e2 = null;//line1
e3 = null;
e2.e = e1;//line3
e1 = null;
}
Eco e;//line 5
}
This program will have a Nullpointer Exception created because at Line 1 you are assigning "null" to e2 and after that at Line 3 you are using the dot operator on a null reference.So This creates a null Pointer Exception.
In Line 5:
Here 'e' is an instance variable of class Eco.So all the objects that you create for Class Eco will have 'e' in it.
[ October 22, 2007: Message edited by: Thirumalai Muthu ]