Fix the Errors
Examine the classes and answer the following questions.
a. Find the two System.out.println() statements that generate compilation errors.
What is (are) the error(s)?
b. If these two lines are deleted, the code compiles. What do the other
System.out.println() statements display? public class X { private int x; protected int y; public X() { x = 0; y = 0; } private int helper(int x) { return x * x; } public int access() { return (helper(x)); } } public class Y extends X { int x; public Y() { super(); x = 2; } public static void main(String[] args) { X temp = new X(); Y tempo = new Y(); System.out. println (temp. access()); System.out. println (tempo. access()); System.out.println(tempo.x); System.out. println (temp.x); temp = tempo; System.out. println (temp. access()); System.out. println (tempo. access()); System.out.println(tempo.x); System.out. println (temp.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.