EOFException and ObjectStreamException both extend IOException.
NotSerializableException extends ObjectStreamException.
AWTException does not extend any of these.
All are checked exceptions.
Suppose class AClass
has a method callMe()
whose declaration is
void callMe() throws ObjectStreamException
Which of the following may appear in a subclass of AClass
?
A. void callMe() B. void callMe() throws IOException C. void callMe() throws NotSerializableException D. void callMe() throws ObjectStreamException, AWTException
A, C.
All exceptions declared by an overriding method must be compatible with types thrown by the overridden version.