Question 4
Not yet
answered
Flag question
package com.fptu.java;
public class Test {
public static void main(String[] args) {
}
Subclass s1 = new Subclass();
s1.foo(); // line 6
Super s = new Subclass();
s.foo(); // line 8
}
class Super {
private void foo() {
}
System.out.println("Super");
}
class Subclass extends Super {
public void foo() {
}
System.out.println("Subclass");
}
O A. Compile time error at line 6
○ B. Compile time error at both line 6 and 8
○ C. Works fine and prints "Subclass" two times.
D. Compile time error at line 8