我做了一个程序:
try{
File f1=new File
((String)equest.getRealPath"photo")/"+temp);
FileOutputStream o=new FileOutputStream(f1);
o.close();
}catch(FileNotFoundException e){
e.printStackTrace();
}请问FileNotFoundException能否被IOException和Exception替代,
原因是什么,还有被IOException和Exception替代,两者有什么区别。
try{
File f1=new File
((String)equest.getRealPath"photo")/"+temp);
FileOutputStream o=new FileOutputStream(f1);
o.close();
}catch(FileNotFoundException e){
e.printStackTrace();
}请问FileNotFoundException能否被IOException和Exception替代,
原因是什么,还有被IOException和Exception替代,两者有什么区别。
而Exception 是IOException 的父类
捕捉异常要从小的开始写啊
try{
File f1=new File
((String)equest.getRealPath"photo")/"+temp);
FileOutputStream o=new FileOutputStream(f1);
o.close();
}catch(FileNotFoundException e){
e.printStackTrace();
}catch (IOException ex )
{
ex.printStackTrace();
}catch (Exception ex1)
{
ex.printStackTrace();
}