Skip to content

Instantly share code, notes, and snippets.

@koduki
Created January 31, 2010 08:40
Show Gist options
  • Save koduki/290967 to your computer and use it in GitHub Desktop.
Save koduki/290967 to your computer and use it in GitHub Desktop.
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
public class ExceptionSample {
public void f(){
try{
new FileInputStream(new File(""));
}catch (FileNotFoundException e) {
throw new RuntimeException(e);
}
}
public static void main(String[] args) {
try{
(new ExceptionSample()).f();
}catch (Exception e) {
if(e.getCause() instanceof FileNotFoundException){
System.out.println("ファイルが無いよー");
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment