1.创建类对象数组
Student[] s = new Student[20];
for (int i = 0; i < s.length; i++) {
s[i] = new Student();
s[i].name = "student" + i;
s[i].number = i+1;
}
错误示例:
Student[] s = new Student[20];
for (int i = 0; i < s.length; i++) {
s[i].name = "student" + i;
s[i].number = i+1;
}