Last active
November 15, 2020 21:01
-
-
Save mcsee/c8fefffd87c98af9bec173266f090497 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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