How to print String array in Java using for loop?

To print String array in Java using for loop, call System.out.println inside for (var item : array).

Here's how you do it:

String[] array = new String[] { "Hello", "World", "!" };

// Hello
// World
// !
for (String item : array) {
  System.out.println(item);
}