Question 101 · 200 in bank
Given:
and the code fragment: S2 sobj = new S2(); sobj.display(10, 100); What is the result?
Show answer
Answer: A
Explanation
Answer is A. class S1 { protected void display(int x) { System.out.println("Parent" + x); } } public class S2 extends S1 { public void display(int x, int y) { this.display(x); display(y); super.display(y); } public void display(int x) { System.out.println("Child" + x); } public static void main(String[] args) { S2 sobj = new S2(); sobj.display(10, 100); // Child10 Child100 Parent100 } }
Source: Adapted from community discussion — UAK94

