1
Loading subject content…
Loading subject content…
Loading practice questions…
What is the output of the following program?
public class Main {
public static void main(String[] args) {
A a = new B();
System.out.println(a.s());
}
}
class A { static String s() { return "A"; } }
class B extends A { static String s() { return "B"; } }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()); } }