Java | Inheritance | Question 5 Read Discuss Courses Practice Improve Article Improve Save Article Save Like Article Like Output of following Java program? class Base { public void Print() { System.out.println("Base"); } } class Derived extends Base { public void Print() { System.out.println("Derived"); } } class Main{ public static void DoPrint( Base o ) { o.Print(); } public static void main(String[] args) { Base x = new Base(); Base y = new Derived(); Derived z = new Derived(); DoPrint(x); DoPrint(y); DoPrint(z); } } (A) Base Derived Derived (B) Base Base Derived (C) Base Derived Base (D) Compiler Error Answer: (A) Explanation: See question 1 of https://www.geeksforgeeks.org/output-of-java-program-set-2/Quiz of this Question Last Updated : 28 Jun, 2021 Like Article Save Article Please Login to comment...