मैं निम्नलिखित सरल कोड:मुझे "अनचाहे अपवाद प्रकार IOException" क्यों मिलता है?
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)[email protected]:~/work/java$ mcedit io.java
किसी को भी किसी भी विचार क्यों है? मैं सिर्फ योग वेब साइट (here) पर दिए गए कोड को आसान बनाने की कोशिश की। क्या मैंने अधिक विस्तार किया?