import java.io.*;
class ShowFile {
public static void main(String args[])throws IOException {
int i;
FileInputStream fin;
try {
fin=new FileInputStream(args[0]);
} catch(FileNotFoundException exc) {
System.out.println("File Not Found");
return;//它在这里有什么作用呢,为什么不能注释了呢
} catch(ArrayIndexOutOfBoundsException exc) {
System.out.println("Usage: ShowFile File ");
return;//它在这里有什么作用呢,为什么不能注释了呢
}
do{
i=fin.read();
if(i!=-1)System.out.print((char) i);
}while(i!=-1);
fin.close();
}
}

解决方案 »

  1.   

    你发生了异常下面的操作都是没有必要执行的~~
    就是执行了也不出现错误的
    所以用return返回
      

  2.   

    应该是可以注释的吧?
    只不过catch后的语句应该不会执行。
      

  3.   

    不可以注释的注释后这里fin.read();会出现错误啊!不行你试试就知道了啊!
      

  4.   

    那为什么不把RETURN换成BREAK?
      

  5.   

    推荐看看《Java核心技术卷1:基础知识》,里面对于异常的种类以及继承关系做了详细的介绍
    ArrayIndexOutOfBoundsException是RuntimeException的子类属于未检查异常,他们要么是不可控制的(Error)或者是我们首先就应该避免他们发生(RuntimeException)
      

  6.   

    learning~~不解,高人来解释下!
      

  7.   

    return 的作用相当于System.exit()
    如果注释掉,就会执行
                      do{
    i=fin.read();
    if(i!=-1)System.out.print((char) i);
    }while(i!=-1);
    可以把它修改一下. 
                      do{
    if (fin != null) 
                                  i=fin.read();
             
                                if(i!=-1)System.out.print((char) i);
    }while(i!=-1);                  if (fin != null) 
                          fin.close();