Description
修改《学生列表》题目,使用学生Map来存放学生的集合,其中key为学号,value为学生对象 输出时按照学生的学号顺序输出
Input
学生个数 学生对象数据 操作数 操作内容
Output
按照学号顺序输出集合中的学生
Sample Input
4 1 wong 90 2 liu 80 3 chen 70 4 fang 60 3 add 5 duan 80 delete 3 set 4 70
Sample Output
no:1 name:wong score:90 no:2 name:liu score:80 no:4 name:fang score:70 no:5 name:duan score:80
import java.util.*;
class Student{
private int no;
private String name;
private int score;
public Student(int no, String name,int score) {
this.no = no;
this.name = name;
this.score = score;
}
public String toString()
{
return "no:" + this.no + " name:" + this.name + " score:" + this.score;