慕雪036441
2018-03-14 15:43
public void testPut() {
Scanner sc = new Scanner(System.in);
int i=0;
while(i<3) {
System.out.println("put id");
String ID = sc.next();
Student st = students.get(ID);
if(st==null)
{
System.out.println("put name");
String name = sc.next();
Student newStudent = new Student(ID,name);
students.put(ID, newStudent);
System.out.println("ok add"+students.get(ID).name);
i++;
}else {
System.out.println("get out");
}
}
}
System.out.println("ok add"+students.get(ID).name); 这个后面的.name,你有没有getset
解决了
Java入门第三季
409792 学习 · 4340 问题
相似问题
回答 7