幫忙看看我的代碼問題出在哪 謝謝謝謝
package com.immoc;
import java.util.Scanner;
public class HelloWorld {
public static void main(String[] args) {
?? ?Scanner input=new Scanner(System.in);
?? ?System.out.println("請輸入得分:");
?? ?int score=input.nextInt();
?? ?System.out.println("請輸入性別:");
?? ?String sex=input.nextLine();
?? ?if(score>80){
?? ??? ?if (sex.equals("男")) {
?? ??? ??? ?System.out.println("進入男子組決賽");
?? ??? ??? ?}else if(sex.equals("女")){
?? ??? ??? ?System.out.println("進入女子組決賽");
?? ??? ??? ?}
?? ?}else{
?? ??? ?System.out.println("淘汰");
?? ?}
}
}
運行的時候,輸入得分以后在輸入性別的時候輸入不了,這是為什么?
2017-03-24
你把分數和性別換個位置就可以了 這個屬于輸入掃描器的bug
2017-03-24
同意樓上說的:你把分數和性別換個位置就可以了 這個屬于輸入掃描器的bug