hello happy new year and thankyou for reading this
i am experimenting with io at the moment and came across the following puzzle
why in the code below do I have to include the
return;
at the end of the try/catch statement for the file to compile without the
fin might not be initialized error
import java.io.*;
class CopyFile {
public static void main(
String args[]) throws IOException {
int i;
int a=args.length;
int b;
int c=54;
FileInputStream fin;
FileOutputStream fout;
try {fin=new FileInputStream(args[0]); } catch (FileNotFoundException e) { System.out.println("filenferror"); return;}
try {
i=fin.read();
} catch (IOException e) { System.out.println("fileerror");
}
fin.close();
}
}