Playing Compiler—Access Issues
Explain why the following code does not compile.
public class Papa { private int x; public Papa() { x = 0; } public Papa(int y) { x = y; } } public class Son extends Papa { public Son() { } public Son(int x) { super(x); } public static void main(String[] args) { Son s = new Son(); System.out.println(s.x); Papa t = new Son(2); System.out.println(t.x); } }
We need at least 10 more requests to produce the solution.
0 / 10 have requested this problem solution
The more requests, the faster the answer.