【发布时间】:2011-01-19 08:13:54
【问题描述】:
我有以下简单的代码:
import java.io.*;
class IO {
public static void main(String[] args) {
BufferedReader stdIn = new BufferedReader(new InputStreamReader(System.in));
String userInput;
while ((userInput = stdIn.readLine()) != null) {
System.out.println(userInput);
}
}
}
我收到以下错误消息:
----------
1. ERROR in io.java (at line 10)
while ((userInput = stdIn.readLine()) != null) {
^^^^^^^^^^^^^^^^
Unhandled exception type IOException
----------
1 problem (1 error)roman@roman-laptop:~/work/java$ mcedit io.java
有人知道为什么吗?我只是试图简化 sum 网站 (here) 上给出的代码。我是否过于简单化了?
【问题讨论】:
标签: java stdin readline ioexception