I have written a function as below, In try block I am throwing IOException which is handled by next catch block and its again throwing FileNotFoundException, In the finally block I again throw a NULLPointerException. so my question is FileNotFOundException exception is unhandled exception? why the caller function only get NULLPointerException only,Although FileNotFounException is unhandled(what I am assuming)?
static void fun(){
try{
throw new IOException();
}
catch(IOException e){
throw new FileNotFoundException();
}
finally{
throw new NullPointerException();
}
}
Aucun commentaire:
Enregistrer un commentaire