Given a sample code:
abstract class A {
abstract void a1();
void a2() {
System.out.print(" A");
}
}
class B extends A {
void a1() {
}
void a2() {
System.out.print(" B");
}
}
class Test extends B {
public static void main(String[] args) {
{
A y = new B();
y.a2();
Test z = new Test();
z.a2();
}}}
What will be the result? Choose the correct option?
(A) A A
(B) A B
(C) B B
(D) B A
(C)
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.