Quiz · Classes and objects · lesson 10 of 10
Quiz — a field of null
What happens when this program is compiled and run?
public class Main {
public static void main(String[] args) {
Point p = new Point();
Point q = p;
p = null;
System.out.println(q.x);
System.out.println(p.x);
}
}
class Point { int x; }