求教一个小的Java程序,
import java.io.*;class ShowFile{
public static void main(String args[])
throws IOException{
int i;
FileInputStream fin=new FileInputStream(args);
try{
fin=new FileInputStream(args);
}
catch(ArrayIndexOutOfBoundsException exc){
System.out.println("Usage: ShowFile File");
return;
}
catch(FileNotFoundException exc){
System.out.println("File Not Found");
return;
}
do{
i=fin.read();
if(i!=-1) System.out.println((char)i);
} while(i!=-1);
fin.close();
}
}
请教return 在程序中的作用。为什么去掉return之后,就会产生一个编译错误呢? 有没有Return应该不妨碍编译,不知道楼主是怎么操作的。通常来说,无参的Return语句用来终止一个嵌套模块,用在这里就比较奇怪。 能不能把错误,贴出来。另外Java的版本
页:
[1]