A

Admin • 825.56K 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
  • Correct Answer - Option(A)
  • Views: 3
  • Filed under category Java
  • Hashtags:

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.

Be the first to start discuss.