Skip to content

Instantly share code, notes, and snippets.

@arn-e
Created January 15, 2013 20:21
Show Gist options
  • Save arn-e/4541686 to your computer and use it in GitHub Desktop.
Save arn-e/4541686 to your computer and use it in GitHub Desktop.
checked exception handling in Java
import java.io.FileInputStream;
import java.io.File;
import java.io.FileNotFoundException;
public class FileReaderTest {
public static void main(String[] args) {
File newFile = new File("./public/sample_file.text");
try {
FileInputStream fileStream = new FileInputStream(newFile);
} catch(FileNotFoundException exception) {
exception.printStackTrace();
throw new RuntimeException("Oh, a Runtime Exception?");
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment