Created
January 19, 2011 21:28
-
-
Save ejknapp/786899 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| package java112.labs1; | |
| import java.util.*; | |
| import java.io.*; | |
| /** | |
| * @author Eric Knapp | |
| * class ExceptionsDemo | |
| * | |
| */ | |
| public class ExceptionsDemo { | |
| public void run() { | |
| BufferedReader input = null; | |
| try { | |
| input = new BufferedReader(new FileReader("compile.sh")); | |
| System.out.println("the file was there!"); | |
| } catch (FileNotFoundException fileException) { | |
| System.out.println("no file!"); | |
| fileException.printStackTrace(); | |
| } catch (IOException ioException) { | |
| ioException.printStackTrace(); | |
| } catch (Exception exception) { | |
| exception.printStackTrace(); | |
| } finally { | |
| try { | |
| if (input != null) { | |
| input.close(); | |
| } | |
| } catch (Exception exception) { | |
| exception.printStackTrace(); | |
| } | |
| } | |
| } | |
| public static void main(String[] args) { | |
| ExceptionsDemo demo = new ExceptionsDemo(); | |
| demo.run(); | |
| } | |
| } | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment