Two-dimensional array is an array of two-dimensional array of each element one-dimensional array is one-dimensional array
Definition Format
1. Data Type [] [] = new Array name Data type [Several one-dimensional array] [Several one-dimensional array elements];
int [] [] arr = new int [3] [2]; // contains arr 3-dimensional array of length 2 of a two-dimensional array
public static void main(String[] argv ) { int[][] arr= new int[2][3]; System.out.println(arr);
result:
[[I @ 15db9742 two-dimensional array of length
2. The second definition format that allows two-dimensional array of one-dimensional array length species according to their needs change, the length of each one-dimensional array can be different
Data Type [] [] = new Array name Data type [Several one-dimensional array] [];
int [] [] arr = new int [3] []; // declaration corresponds to a three-dimensional array
arr [0] = new int [2]; // this is a
arr [0] = {1,2,3}; // no open space wrong int [] arr = {1,2,3}; this is not affirmed and assignment separately