Home / Programming MCQs / JAVA MCQs / Question

R

Ram Sharma • 188.81K Points
Coach

Q. Output of following Java Program?

Code:
class Base {
    public void show() {
       System.out.println("Base::show() called");
    }
}
  
class Derived extends Base {
    public void show() {
       System.out.println("Derived::show() called");
    }
}
  
public class Main {
    public static void main(String[] args) {
        Base b = new Derived();;
        b.show();
    }
}
(A) Derived::show() called
(B) Base::show() called
(C) Either A or B
(D) None of these

No solution found for this question.
Add Solution and get +2 points.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.