Skip to content

Instantly share code, notes, and snippets.

@mcsee
Last active November 15, 2020 21:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mcsee/c8fefffd87c98af9bec173266f090497 to your computer and use it in GitHub Desktop.
Save mcsee/c8fefffd87c98af9bec173266f090497 to your computer and use it in GitHub Desktop.
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
public class FileReader {
public static void main(String[] args) {
FileReader file = null;
try {
file = new FileReader("source.txt");
file.read();
}
catch(FileNotFoundException e) {
e.printStackTrace();
}
catch(FileLockedException e) {
e.printStackTrace();
}
catch(FilePermissionsException e) {
e.printStackTrace();
}
catch(IOException e) {
e.printStackTrace();
}
finally {
try {
file.close();
}
catch(IOException e) {
e.printStackTrace();
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment