当我运行以下代码并在提示输入时键入 50 时:
private static int nPeople;
public static void main(String[] args) {
nPeople = 0;
System.out.println("Please enter the amount of people that will go onto the platform : ");
BufferedReader keyboard = new BufferedReader(new InputStreamReader(System.in));
try {
nPeople = keyboard.read();
} catch (IOException e) {
e.printStackTrace();
}
System.out.println(" The number of people entered --> " + nPeople);
}
}
我得到以下输出:
请输入进入平台的人数:50 输入的人数 --> 53
为什么我输入 50 时返回 53 ?谢谢。