Different ways to print array in java

Ways to print Array in Java

Below are different ways to print string, int or any array in java.

Way 1: Using for loop

Output:

If you want to print output in one line check this post

To print int array.

Output:

Way 2: Using for Arrays.toString() method

Output:

Help others by sharing the content!

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.