Exceptions

by Michael Thomas

(Tutorial Home Page)

by Michael Thomas

(Tutorial Home Page)

(not completed)

Topic Notes
   
Throwing exception.
  • An overridden method in a subclass may only throw exceptions that are declared in the parent.
  • An overridden method in a subclass can throw fewer or no exceptions.
Creating an exception if (myRef == null )
   throw new NullPointerException();