对象数组的声明有两种方式
一,先定义,再开辟空间
先构造了一个类StudentOfSoftware;
声明数组如下:
类名称 对象数组名[] = null;
对象数组名 = new 类名称[长度];
StudentOfSoftware students[] = null;
students=new StudentOfSoftware[5];
二,定义并开辟数组
同样先构造了一个类StudentOfSoftware;
创建数组方法如下:
类名称 对象数组名[] = new 类名称[长度];
StudentOfSoftware students[] = new StudentOfSoftware[5];