Kizspy | Question: 27
(Choose 1 answer)
What is the output of the following Java program?
class Test {
void m1(String x) { System.out.println("Parent");}
}
class TestChild extends Test {
public void m2(String x) {
System.out.println("Child");super.m1(x);
}
} public class Main {
public static void main(String[] args) {
Test obj = new TestChild();
if (obj instanceof TestChild) {
obj.m2("FE");
}
A. Compile error
B. Child
Parent
C. Child Child
D. Parent Parent