how to print an array in java

Java
import java.util.Arrays;

class Scratch{
    public static void main(String[] args){
        int[] arr = new int[3];
        System.out.println( Arrays.toString( arr ));
      	//prints [0, 0, 0]
    }
}import java.util.Arrays;

public class Array {

    public static void main(String[] args) {
        int[] array = {1, 2, 3, 4, 5};

        System.out.println(Arrays.toString(array));
    }
}System.out.println(Arrays.toString(arr));int[] intArray = new int[] {1, 2, 3, 4, 5};
System.out.println(intArray);     // prints something like '[I@3343c8b3'String[] array = new String[] {"John", "Mary", "Bob"};
System.out.println(Arrays.toString(array)); // [John, Mary, Bob]
Source

Also in Java: