int [] a= new int[100];
a.length
数字数组,所有元素初始化为0;
boolean数组初始化为false;
string初始化为null;
1.for each
for(int element:a)
System.out.println(element);
//打印数组a的每一个元素;给python比较像;
/*更简单的打印数组中的所有值
*/
Arrays.toString(a);
2.数组初始化和匿名数组
java中允许数组长度为0,new int[0];
3.数组拷贝
int []copiedLuckyNumbers = Arrays.copyOf(luckyNumbers,2*luckNumbers.length)
int []a = new int[100];
//等同于
int*a=new int[100];//无指针运算,不能通过a+1得到数组的下一个元素
//数组排序
Arrays.sort(a);//快排
4.多维数组
double [] [] balances;
balances = new double[][];
//for each处理二维数组
for (double [] row:a)
for(double value:row)
do value
//快速打印
Arrays.deepToString(a)