關于輸入的問題
while(i < 3){
?? ??? ??? ?System.out.println("請輸入學生ID:");
?? ??? ??? ?String id = scanner.nextLine();
?? ??? ??? ?//判斷該id是否被占用
?? ??? ??? ?Student st = students.get(id);
?? ??? ??? ?if (st == null) {
?? ??? ??? ??? ?System.out.println("請輸入學生姓名:");
?? ??? ??? ??? ?String name = scanner.nextLine();
?? ??? ??? ??? ?//創建新的學生對象
?? ??? ??? ??? ?Student newStudent = new Student(id, name);
?? ??? ??? ??? ?//通過調用student的put方法,添加id-學生映射
?? ??? ??? ??? ?students.put(id, newStudent);
?? ??? ??? ??? ?System.out.println("成功添加學生:"+students.get(id).getName());
?? ??? ??? ??? ?i++;
?? ??? ??? ?}else {
?? ??? ??? ??? ?System.out.println("該學生ID已被占用!");
?? ??? ??? ??? ?continue;
?? ??? ??? ?}
?? ??? ?}
出現這種情況,就是在輸入的時候選擇中文輸入法,就會無法輸入!
打印輸出的字變成了綠色然后就再也無法輸入別的內容了!
這是什么情況??!
2016-10-19
但是在輸入數字字母的時候就會自動切換到下一行,而輸入漢字就要手動切換!后來查了下,eclipse的通病,無解!
2016-10-16
你那個提示輸出語句是自動換行的輸出語句;手動輸入信息要在下一行輸出即可,跟輸入法沒關系--
“請輸入學生ID:”
“輸入的信息”