What is the result of attempting to compile and run the following code?
class A { <br>
public void method() { <br>
System.out.println("A"); ,<br>
} <br>
} <br>
class B extends A { <br>
public void method() { <br>
System.out.println("B"); <br>
} <br>
} <br>
public class Test { <br>
public static void main(String[] args) { <br>
A obj = new B(); <br>
obj.method(); <br>
} <br>
}
-
A
Compilation error
-
B
Runtime error
-
C
"A"
-
D
"B"