public static void main(String[] args) {
int[] arr1 = new int[]{23,12,5};
System.out.println(arr1[0]);//23
System.out.println(arr1[1]);//12
System.out.println(arr1[2]);//5
System.out.println(arr1);//0x001
arr1[0] = 13;
System.out.println(arr1[0]);//13
int[] arr2 = {14,18,15};
System.out.println(arr2[0]);//14
System.out.println(arr2[1]);//18
System.out.println(arr2[2]);//15
System.out.println(arr2);//0x002
arr2[1] = 12;
System.out.println(arr2[1]);//12
}
数组赋值与输出
最新推荐文章于 2023-02-18 23:07:11 发布