Eclipse / Yosemite中有什么东西坏了吗?我已经尝试了所有我能想到的东西来读取一个键入的键,它总是被忽略,程序终止没有消息,然后返回编辑器。
目前的尝试是:
System.out.println( "Read the keyboard");
try {
selection = (char) System.in.read();
System.out.print("You entered ");
System.out.println(selection);
}
catch (IOException e){
System.out.println("Error reading from user: " + e.getMessage());
}
System.out.println( "Selection: " + selection);
“读取键盘”输出到Eclipse控制台,然后程序返回编辑器。我尝试过其他阅读键盘的方法,所有方法都有相同的结果。