
Creating Exceptions for Methods
Use
When you create an exception for a method, you can decide if you want to use the classical exceptions or the new class-based exceptions in the method. When you use the class-based method, exceptions are represented with objects of exception classes at runtime.
Prerequisites
The method for a class or interface was already created.
Procedure
To create an exception for a method:
Example: 
Result
You defined exceptions for a method and can now implement the method.
See also:
Defining Exception Classes Implementing Methods.