What is the output of the following program?
class Question extends SuperClass { String s = "this"; public static void main(String[] args) { new Question(); }/*from w w w. j a va 2 s . c om*/ Question() { super.display(s); } void display(String s) { System.out.println("this: " + s); } } class SuperClass { String s = "super"; void display(String s) { System.out.println("super: " + s); } }
B.
The display()
method of SuperClass is invoked to display the s variable of Question.