面向对象第二章

1.引用类型数组: 1)Student[] stus = new Student[3]; //创建Student数组对象 stus[0] = new Student("zhangsan",25,"LF"); //创建Student对象 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[]{ new Student("zhangsan",25,"LF"), new Student("lisi",26,"JMS"), 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

猜你喜欢

转载自www.cnblogs.com/ahaijava/p/9965889.html