class Sinfo {
public String name;
public int age;
public int grade;
public Sinfo() {
// TODO Auto-generated constructor stub
}
}
Scanner cin = new Scanner(System.in);
int n = cin.nextInt();
Sinfo[] su = new Sinfo[n];
while (cin.hasNext()) {
for (int i = 0; i < su.length; i++) {
su[i].name = cin.next();
su[i].age = cin.nextInt();
su[i].grade = cin.nextInt();
}
}
su[i].name = cin.next();
前面加上
su[i] = new Sinfo();