The reason it prints sample is because your if statement doesn't check for anything and allows the sample method to be processed. Try this..
public final class Test4 {
class Inner {
void test() {
if (Test4.this.flag == true) {
sample();
}
else {
System.out.println("The flag is false");
}
}
}
private boolean flag = false;
public void sample() {
System.out.println("Sample");
}
public Test4() {
(new Inner()).test();
}
public static void main(String args []) {
new Test4();
}
}
[ May 29, 2003: Message edited by: Shane Hartman ]