Hi,
I am new to this forum and got a question. I saw this question in the JDcert mock exam and got a doubt.
In this code, what will be the output? I tried tu run and got "Sample" as the output. But why the compiler passes this statement "if (Test4.this.flag); ", ie, if ending with a semicolon?
public final class Test4 {
class Inner {
void test() {
if (Test4.this.flag); {
sample();
}
}
}
private boolean flag = true;
public void sample() {
System.out.println("Sample");
}
public Test4() {
(new Inner()).test();
}
public static void main(String args []) {
new Test4();
}
}
Somebody pls help me.
Thanks
Santhy