Exceptions: Throw Statement Tutorial

The throw keyword is used to manually cause an exception to occur.
A throw statement can throw either a checked or unchecked exception.
The structure of a throw statement looks like this:( throw ) ( new ) ( ExceptionClass(argument list) )( ; )

In this tutorial I will demonstrate how to throw an unchecked exception.
Throwing a checked exception requires an understanding how to use the throws keyword, so I will demonstrate how to throw a checked exception in my next tutorial.

Open the command prompt (CMD - see the Getting Started ) and type in the following commands.