Question OOP-POLY-0018
HardWhat is the output of this code?
class Parent { static void show() { System.out.println("Parent static"); } }
class Child extends Parent { static void show() { System.out.println("Child static"); } }
public class Main {
public static void main(String[] args) {
Parent p = new Child();
p.show();
}
}
- A.
Parent static Child static
- B.
Error
- C.
Parent static
- D.
Child static
Sign up free to see the answer and a step-by-step explanation.