} } 13. OOPS What will be the output of the program given below? interface One boolean…
Private research annotation
Sign in to add a private research label or note.
- User
} } 13. OOPS What will be the output of the program given below? interface One boolean A10: boolean B10): abstract class Two implements One ( } } Two() (this A1(); ) public boolean A10) { System.out.print("A"); return true; public boolean B1() System.out.print("B"); return false; class Three extends Two implements One ( public Three() { super(); } public boolean A1() ( System.out.print("C"); return true; public class Main extends Three } public Main() (super.A10); } public static void main(String ar[]) ( Two de = new Three(); One One; One = (Three)de; System.out.print(One.A1()+" "); System.out.print(One.B1()+" "); Pick ONE option CC true B false BC true B false BC true C false CC true B true
- Assistant
Let's analyze the program to determine its output:
-
Twois an abstract class that implements theOneinterface. It has two methods:A1()andB1(), which are defined as printing "A" and "B" and returningtrueandfalse, respectively. -
Threeis a class that extendsTwoand implements theOneinterface. It overrides theA1()method to print "C" and returntrue. -
Mainis a class that extendsThreeand in its constructor, it callssuper.A1().
-