Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
public class NestedForLoopBreak{
public static void main(String[] args){
label0:
for(int i=1; i<5; i++){
for(int j=1; j<5; j++){
for(int k=1; k<5; k++){
int l3Product = i*j*k;
if(l3Product > 10){
break label0;
}
System.out.printf("%d * %d * %d is: %d \n", i, j, k, l3Product);
}
}
}
System.out.println("Got out of 3 layer maze!");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.