What will be the output when the following code is executed? ``` public class A { public void print() { System.out.println("A"); } } public class B extends A { public void print() { System.out.println("B"); } } public class C extends B { public void print() { System.out.println("C"); } } public class Main { public static void main(String[] args) { A obj = new C(); obj.print(); } } ```




© 2024 Fiveable Inc. All rights reserved.
AP® and SAT® are trademarks registered by the College Board, which is not affiliated with, and does not endorse this website.

© 2024 Fiveable Inc. All rights reserved.
AP® and SAT® are trademarks registered by the College Board, which is not affiliated with, and does not endorse this website.