1. 数组(Array):相同类型数据的集合就叫做数组。2. 数组的定义与赋值(系统会默认初始化)普通数组: 1 package com.li; 2 3 public class Array{ 4 5 public static void main(String[] ...
1. 数组(Array):相同类型数据的集合就叫做数组。
2. 数组的定义与赋值(系统会默认初始化)
普通数组:
1 package com.li; 2 3 public class Array{ 4 5 public static void main(String[] args) { 6 // TODO 自动生成的方法存根 7 int[] a=new int[2]; 8 9 /*10 * int a[]=new int[2];11 * int[] a={0,1}; 12 * int[] a=new int[]{0,1}; //type[] 变量名 = {new type[]}{逗号分隔的初始化值列表};13 */14 a[0]=0;15 a[1]=1;16 System.out.println(a[0]);17 System.out.println(a[1]);18 19 System.out.println("---------------------------------------");20 /*错误的方法21 int[] b = null;22 for(int i=0;i<10;i++){23 b[i]=i;24 System.out.println(b[i]);25 }26 */27 28 29 }
海外公司注册、海外银行开户、跨境平台代入驻、VAT、EPR等知识和在线办理:https://www.xlkjsw.com
原标题:数组(Array)
关键词:array
*特别声明:以上内容来自于网络收集,著作权属原作者所有,如有侵权,请联系我们:
admin#shaoqun.com
(#换成@)。