Java break

Last Updated: March 17, 2022

Java break statement terminates execution of the current look and continues executing the next lines of the code

Java while loop break example

int[] numbers = { 125, 132, 95, 116, 110 };
int i =0;
     if(numbers[i]==95) break;
     System.out.println("Number is "+numbers[i]);
 System.out.println("Out of the Loop");


Number is 125
Number is 132

Out of the Loop

When the program controller meets the line if(numbers[i]==95) break; , the controller will return from the loop start executing the next lines of the program