为啥这段Java运行总是出错

2025-05-18 22:55:49
推荐回答(2个)
回答1:

int i;
try {
i = System.in.read();
System.out.printf("i = %d", i);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
要加上trycatch

回答2:

需要加try{...} catch()语句