我有这种方法的一个问题:“System.in.read()” 中的Java
public void runTransaction(){
//Some calculations...
wait();
//Other calculations...
}
private static void wait(){
try {
System.out.println("Press <enter> to continue");
System.in.read();
}
catch (java.io.IOException ex) {
System.out.println("Input error...");
}
}
但按下回车键后,PROGRAMM不会继续。我使用的是Ubuntu 12.04。
编辑:该程序确实打印消息“按继续”,但不会继续之后,它只是等待输入。
这个方法叫做什么?给我们多一点代码 – Mirco
我编辑了我的帖子。方法'runTransaction'在'main'方法中被多次调用。 – user3019653