Q. What is the output of following Java Program?

Code:
class Base {
    final public void show() {
       System.out.println("Base::show() called");
    }
}
  
class Derived extends Base {
    public void show() {
       System.out.println("Derived::show() called");
    }
}
  
class Main {
    public static void main(String[] args) {
        Base b = new Derived();;
        b.show();
    }
}
  • (A) Base::show() called
  • (B) Derived::show() called
  • (C) Compiler Error
  • (D) Runtime Error
πŸ’¬ Discuss
βœ… Correct Answer: (C) Compiler Error

You must be Logged in to update hint/solution

πŸ’¬ Discussion


πŸ“Š Question Analytics

πŸ‘οΈ
362
Total Visits
πŸ“½οΈ
4 y ago
Published
πŸŽ–οΈ
Ram Sharma
Publisher
πŸ“ˆ
92%
Success Rate