Created
January 31, 2010 08:40
-
-
Save koduki/290967 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
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