Ankur kothari wrote:this compiles because now the compiler doesnt have a problem since you are catching the error....or what you can do is declare that main method throws filenotfoundexception which is called ducking the exception
yes ankur is correct, it is because object create at run time not compile time...at the time of compilation, the compiler think this the method of Master class and it should be catch or throws the exception.