Multiple Choices
Answer (Choose 1 answer)
What will happen when you attempt to compile and run the following program:
abstract class A {
int x=5;
void foo() {
System.out.print(x);
}
}
class B extends A {
int y=7;
void foo() {
System.out.print(x+y);
} }
class Main {
public static void main(String[] args) {
A t = new B(); // (*)
t.foo();
}
A. The output of the program is 12
B. The output of the program is 7
C. The output of the program is 5
D. The code line (*) causes a compile-time error.