public class Superclass public void print System out printfS
public class Superclass {public void print() {System, out. printfSuperclass.\");}} public class Subclass extends Superclass {public void print() {super.print(); System, out. printfSubclass.\");} public static void main(String[] args) {Subclass s = new Subclass(); s.print();}} Superclass.Subclass. Subclass.Superclass. Subclass. Superclass.
Solution
Answer is > Superclass.Subclass
This is because the Subclass print() method had called the Superclass print() method before printing. super keyword is used to reference to the base class or parent class. Therefore calling super.print() will call the print() method of the parent class.
feel free if you have any doubt :)
