Explain the code | Pointer in java
public class TestPointers {
public static void main(String args[]) {
Object p1, p2;
p1 = new Object();
p2 = p1;
p1 = null;
System.out.println(p2);
}
}
public static void main(String args[]) {
Object p1, p2;
p1 = new Object();
p2 = p1;
p1 = null;
System.out.println(p2);
}
}
Comments
Post a Comment