23
Throwing Exceptions
•You can write code that:
–throws one of the standard Java exceptions, or
–an instance of a custom exception class that you have designed.
•The throw statement is used to manually throw an exception.
–throw new ExceptionType(MessageString);
•The throw statement causes an exception object to be created and thrown.