Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

java FileNotFoundException

try {
    FileInputStream fileHanlde = new FileInputStream(fileName);    // this file doesn't exist
} catch (FileNotFoundException e) {
    System.out.println("Sorry can't find the file");    // always catch the most specific exception first
} catch (IOException e) {
    System.out.println("Unknown IO error");
} finally {
    System.out.println("Clean up duty");
}
 
PREVIOUS NEXT
Tagged: #java #FileNotFoundException
ADD COMMENT
Topic
Name
9+8 =