Examine the following code which includes an inner class:
public final class Test4 implements A {
class Inner {
void
test() {
if (Test4.this.flag); {
sample();
}
}
}
private boolean flag = false;
public void sample() {
System.out.println("Sample");
}
public Test4() {
(new Inner()).test();
}
public static void main(
String args []) {
new Test4();
}
}
What is the result:
A. Prints out "Sample"
B. Program produces no output but terminates correctly.
C. Program does not terminate.
D. The program will not compile
Select the most appropriate answer.
//I THOUGHT THIS SHOULD NOT COMPILE SINCE THE INNER CLASS IS CREATED INCORRECTLY (new Inner()), without creating an instance of the outer class ???