OK, so I was looking up the goto statement in java, and I stumbled on this post: Is there a goto statement in Java? (I know, I'm a scrub :P )
Anyways, I stumbled across this chuck of code in the comments:
public static void main(String [] args) {
boolean t = true;
first:
{
second:
{
third:
{
System.out.println("Before the break");
if (t) {
break second;
}
System.out.println("Not executed");
}
System.out.println("Not executed - end of second block");
}
System.out.println("End of third block");
}
}
And I am confused as to why the second block wouldn't have been executed after the break. Can someone explain this to me?
I would've commented to ask, but I don't have a high enough Rep to do so.
Thank you!