站内搜索: 请输入搜索关键词

当前页面: 开发资料首页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:)


谢谢,好了!!!
:)


↑返回目录
前一篇: 比如进行这样的操作 b[1]&OXFF
后一篇: JAVA中如何实现把参数传给一个线程?