About Question com.enthuware.ets.scjp.v6.2.645 :
Posted: Fri Apr 08, 2011 5:28 am
Why can you override IOExcpetion with NullPointerException and not Exception?
NullPointerException is not a subclass IOExcpetion, but Exception is.
Here is the question:
Which of the following exceptions can be declared in the throws clause of a method overriding the method:
public void perform_work( ) throws IOException {...}
IOException
Exception
NullPointerException
No throws clause
Any Subclass of IOException
Right answer, according to the application: IOException, NullPointerException, No throws clause, Any Subclass of IOException.
NullPointerException is not a subclass IOExcpetion, but Exception is.
Here is the question:
Which of the following exceptions can be declared in the throws clause of a method overriding the method:
public void perform_work( ) throws IOException {...}
IOException
Exception
NullPointerException
No throws clause
Any Subclass of IOException
Right answer, according to the application: IOException, NullPointerException, No throws clause, Any Subclass of IOException.