当前页面: 开发资料首页 → J2SE 专题 → System.in问题:错误是Unhandled exception type IOException
System.in问题:错误是Unhandled exception type IOException
摘要: System.in问题:错误是Unhandled exception type IOException
import java.util.*;
import java.io.*;
public class wo{
public static void main(String arg[]){
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
int i = Integer.parseInt(in.readLine());
}
}
错误是Unhandled exception type IOException
是这里in.readLine()
这是什么问题啊?
IOException没有处理
public static void main(String arg[]) throws Exception
{
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
int i = Integer.parseInt(in.readLine());
}
public static void main(String arg[]) throws Exception
{
try{
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
int i = Integer.parseInt(in.readLine());
}
catch(IOException e)
{
//Error Handle....
}
}
哦,第二个就去掉public static void main(String arg[]) throws Exception后面的throws Exception:)
谢谢,好了!!!
:)