(Choose 1 answer)
class does not have the foo() method):
What will happen when you attempt to compile and run the following program (please note that the Object
class A {
void foo() {System.out.print("A");}}
class B {
void foo() {System.out.print("B");}
} class C extends A {
void foo() {System.out.print("C");}}
class Main {
public static void main(String[] args) {
Object t = new A();
t.foo();
t = new B();
t.foo();t = new C();
t.foo();
}
}
A. Compile-time error
B. ABC
C. ACB
D BCA
Q: 12