一 引用类型数组的存储:
1)
Student[] stus = new Student[3];
stus[0] = new Student("zhangsan",25,"lf");
stus[1] = new Student("lisi",26,"jms");
stus[2] = new Student("wangwu",28,"sd");
System.out.println(stus[0].address);
2)
Student[] stus = new Student[]{
stus[0] = new Student("zhangsan",25,"lf"),
stus[1] = new Student("lisi",26,"jms"),
stus[2] = new Student("wangwu",28,"sd")
};
3)
int[][] arr = new int[3][];
arr[0] = new int[2];
arr[1] = new int[3];
arr[2] = new int[2];
arr[1][0] = 100;
4)三行四列矩阵型
int[][] arr = new int[3][4];
for(int i=0,i<arr.length,i++){
for(int j=0,j<arr[i].length,j++){
arr[i][j] = (int)(Math.random()*100);
}
}