j**a 简单问题

时间:2013.09.02 发布人:ruifeng0325

j**a 简单问题

已解决问题

谷歌ruifeng0325用户在2013.09.02提交了关于“荣威950j**a 简单问题”的提问,欢迎大家涌跃发表自己的观点。目前共有1个回答,最后更新于2024-08-03T11:19:12。import***.io.*;
publicclassTest{

publicstaticvoidmain(String[]args){
FileInputStreamfis=newFileInputStream("d:\\sss.txt");
inta=***.read();
while(a!=-1){
System.out.println(a+"");
}
fis.close();
}
}
D盘已经有sss.txt文件
Exceptioninthread"main"j**a.lang.Error:Unresolvedcompilationproblems:
UnhandledexceptiontypeFileNotFoundException
UnhandledexceptiontypeIOException
UnhandledexceptiontypeIOException

atTest.main(***.j**a:5)希望大家能够帮助她。

详细问题描述及疑问:import***.io.*;
publicclassTest{

publicstaticvoidmain(String[]args){
FileInputStreamfis=newFileInputStream("d:\\sss.txt");
inta=***.read();
while(a!=-1){
System.out.println(a+"");
}
fis.close();
}
}
D盘已经有sss.txt文件
Exceptioninthread"main"j**a.lang.Error:Unresolvedcompilationproblems:
UnhandledexceptiontypeFileNotFoundException
UnhandledexceptiontypeIOException
UnhandledexceptiontypeIOException

atTest.main(***.j**a:5)期待您的答案,千言万语,表达不了我的感激之情,我已铭记在心 !

希望以下的回答,能够帮助你。

第1个回答

用户名:ryan4559  

将main里面的代码放到trycatch里面就ok啦。这里涉及到的问答是异常的分类,像ClassNotFoundE刻祖去杂含信xception、IOException、FileNotFoundException、SQLE世钱最对护叶病乱云养xception、InterruptedException不是属于RuntimeException,而是受检异常(checkedexception),该类异常在语法上是要求必须进行处理的,如果不进行处理将会出现语法错误,不能通继表些错有包明过编译。