1 class Demo3_Array{ 2 public static void main(String[] args) { 3 int[] arr1 = new int[3]; 4 int[] arr2 = new int[3]; 5 6 System.out.println(arr1); // 两个不同的地址 7 System.out.println(arr2); 8 9 arr1[0] = 10; 10 arr2[1] = 20; 11 12 System.out.println(arr1[0]); 13 System.out.println(arr1[1]); 14 System.out.println(arr1[2]); 15 16 System.out.println("------------------------------"); 17 18 System.out.println(arr2[0]); 19 System.out.println(arr2[1]); 20 System.out.println(arr2[2]); 21 22 } 23 }
时间: 2024-09-29 07:43:20