Custom exception class
Exception class in addition to the direct use of the sun's written to us, we can also customize your own exception classes according to the needs, follow these steps:
Step1: Define a class inherits Exception ()
Step2: Write Exception in the class two constructors : Exception () and Exception (String)
Then you can throw an exception in other classes where it is needed:
In need of a method behind by throws to declare an exception, and then throw an exception is thrown on ok