10. Given the following code, the output is __. Please select "A, B, C, D, or E" as correct option.Â
class Parent
{
private int x = 5;
int show() { x = 6; return x; }
}
class Child extends Parent
{
public int x = 7;
public Child() { x = 8; x++; x = super.show(); }
}
class Sample
{
public static void main(String[] args)
{
Child c1 = new Child();
System.out.print(c1.x);
}
}
A. 5
B. 6
C. 7
D. 8
E. 9
Answer: B
Comments
Leave a comment