by @codeexamples

How to loop through array in Java using for loop

Home » java » How to loop through array in Java using for loop

This below example shows you how to loop through an array in java by using for loop.

String[] arr = {"passion", "fun", "sun", "lab"};
for (int i = 0; i < arr.length; i++) {
  System.out.println(arr[i]);
}

Output:

passion
fun
sun
lab