import java.util.Arrays; public class ArrayDemo { public static void main(String[] args) { int size = 4; // 数组大小 int[] myList = new int[size];// 定义数组 myList[0] = 5; myList[1] = 12; myList[2] = 33; myList[3] = 52; System.out.println(Arrays.toString(myList)); } }
如果是多维数组使用
Arrays.deepToString(arr)