请大家帮忙看看,是哪里错了?
package student;
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;
import java.util.Set;
public class Maptest {
public Map<String,STUDENT> Students;
public Maptest(){
this.Students=new HashMap<String,STUDENT>();
}
public void Testput(){
Scanner console=new Scanner(System.in);
int i=0;
while(i<3){
System.out.println("请输入学生ID:");
int ID=console.nextInt();
STUDENT ST=Students.get(ID);
if(ST==null){
System.out.println("请输入学生姓名:");
String name=console.next();
STUDENT newStudent=new STUDENT(ID,name);
Students.put("ID", newStudent);
System.out.println("成功添加学生:"+Students.get(ID).getName());
i++;
}
else{
System.out.println("该ID已被占用!");
continue;
}
}
}
public void Testkeyset(){
Set<String> Keyset=Students.keySet();
System.out.println("总共有:"+Keyset.size());
for(String stuID:Keyset){
STUDENT st=Students.get(stuID);
if(st!=null){
System.out.println("学生:"+st.getName());
}
}
}
public static void main(String[] args) {
// TODO Auto-generated method stub
Maptest mp=new Maptest();
mp.Testput();
mp.Testkeyset();
}
}