How to break out of the loop in Java?
class BreakOutOfLoop { public static void main(String[] args) { int[] arr = {1, 2, 3, 4, 5}; // iterate over array for (int i = 0; i < arr.length; i++) { if (arr[i] == 3) { // break out of the loop if the current value is equals to 3 System.out.println(“Breaking out of the loop!”);…
Read More How to break out of the loop in Java?