public class Newfile{
public static void main(String []args){
for(int a=1; a < 5; a++){
for(int b=1; b < 5; b++){
if(a == b){
System.out.println("pair found " + a + " " + b);
break;
}
}
}
}
}
This code just breaks the inner most loop, so it breaks the loop with the b but not the a loop, I am doing this as an exercise.
I was wondering, is there a way to break BOTH loops once a == b
is satisfied?