Java定义数组的方式有以下几种:
int[] array1 = new int[5];
String[] array2 = new String[10];
double[] array3 = new double[3];
int[] array1 = {1, 2, 3, 4, 5};
String[] array2 = {"apple", "banana", "orange"};
double[] array3 = {1.2, 3.4, 5.6};
int[] array1 = Arrays.copyOf(array2, 5);
String[] array2 = Arrays.copyOfRange(array1, 0, 3);
int[] array1 = new int[]{1, 2, 3, 4, 5};
String[] array2 = new String[]{"apple", "banana", "orange"};
double[] array3 = new double[]{1.2, 3.4, 5.6};
int[][] array1 = new int[3][4];
String[][] array2 = new String[2][];
array2[0] = new String[3];
array2[1] = new String[2];