1.数组的概述(引用类型)
2.数组的初始化
成功创建一个数组后,它将完成如下三个动作
3.基本数据类型数组的创建(还没赋值时)
int类型数组:默认值为0
Boolean类型数组:默认为false
4.引用数据类型数组的创建(还没赋值时)
默认值为null;因为数组也是引用类型,元素也是引用类型,所以是数组指向数组元素,数组元素再指向它的值
5.增强的for循环
在JDK5.0中新增了一个增强的for循环语法
for( type element : array)
{System.out.println(element);}
int arr[]={1,32,345,2};
for (int element: arr)
{System.out.println(element+" ");}
优点:适合遍历显示数组或集合中元素的内容
缺点:无法访问数组的下标
6.二维数组(数组的数组)
动态初始化:
int [][] a = new int[4][5];
int [][] b = new int[3][];
b[0] = new int[2];
b[1] = new int[3];
b[2] = new int[5];
?静态初始化:
int [][] array = {{1,2},{2,3},{3,4,5}};
原文:http://www.cnblogs.com/beyondbycyx/p/4184845.html