hi all,
i was going through a site consists of scjp questions and i bumped into this
public class Test {
public static void main(String[] args){
int j = 0;
for(; j < 3; j++){
if (j==1) break out;
System.out.print(j + "\n");
}
out:{System.out.println("bye");}
}
}
1. The code will fail to compile.
2. The code will run with no out put
3. This will run and print 0, 1 , 2 and "bye"
4. This will run and print 1 and "bye"
Now it says 1 is the correct answer and the reason it gives is that "This will fail to compile because the labelled block does not enclose the break statement."
But i think 3 is the right answer. What do you all think what the right answer might be??
Thank you and regards

