LogiQuest
Back to Inheritance and Polymorphism
7

What is the output of the following program?

class A { String hi() { return "A"; } }
class B extends A { String hi() { return super.hi() + "B"; } }
class Main { public static void main(String[] args) { System.out.println(new B().hi()); } }
Easy

Discussion (0)

  • No discussion yet. Ask a doubt or share a shortcut.

Log in to join the discussion.