为了账号安全,请及时绑定邮箱和手机立即绑定

下面是代码,就是名字可以输入,但是输出显示却是null

下面是代码,就是名字可以输入,但是输出显示却是null

陈鹏爱王敏 2017-01-04 09:53:16
System.out.println("请输入学生ID:"); String ID=console.next(); //判断ID是否被占用 Student st=students.get(ID); if(st==null){ //提示输入学生姓名 System.out.println("请输入学生姓名:"); String Name=console.next(); //创建新的学生对象 Student newStudent=new Student(ID,Name); //通过调用students的put方法,添加ID映射学生对象 students.put(ID, newStudent); System.out.println("成功添加学生:"+students.get(ID).Name); i++; }
查看完整描述

1 回答

  • 1 回答
  • 1 关注
  • 1439 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信