Hello friends my Today's question is :
Here is sample code :
File file = new File("d:/asd.txt"); //Assume this path is not available
FileInputStream fileInputStream = null;
try {
fileInputStream = new FileInputStream(file);
} catch (FileNotFoundException e) { // So Exception catch Here
e.printStackTrace();
}
// So now finally block must execute
finally {
try {
fileInputStream.close(); // but here again exception comes here
} catch (IOException e) {
e.printStackTrace(); // So Exception catch Here
}finally {
System.out.println("inner finally"); // This statement executed
}
System.out.println("finally"); // Why this statement is not execute .. ?
}
Provide your Comments and feedback ...Thanks is advance..!!!!
No comments:
Post a Comment