You can create your own class of Exception
and throw
it. If you were to dig out your notes from long ago, you'd find the
following tips:
extends
the existing class Exception
.
String
argument.
super()
to use the
existing exception machinery.
I've included a file SampleException.java
that shows you
how all of this can be done.