import java.io.*;
class ShowFile {
public static void main(
String args[])
throws IOException {
int i;
//FileInputStream fin;
FileInputStream fin = new FileInputStream(args[0]);
try {
fin = new FileInputStream(args[0]);
}
catch ( FileNotFoundException e) {
System.out.println( "File Not Found" );
return;// Why return is needed here...???
}
catch (ArrayIndexOutOfBoundsException e) {
System.out.println( "Usage: ShowFile File" );
return;
}
do {
i = fin.read();
if(i != -1) System.out.print( (char) i);
} while(i != -1);
fin.close();
}
}
//FileInputStream fin; Why the bold line gives an error stating that fin is not initialized???
Why the need for redundancy in:
FileInputStream fin = new FileInputStream(args[0]);
Also what purpose does the return statement have in a catch{} Block???