java- custom exception

Custom anomaly 
1, a first custom class, inherit Exception class

 

 

2, create an exception class that contains a test method, the time when the capture b / a in the a = 0, thrown

 

 

 3. Create a test class to inherit on an exception class, the class is instantiated objects, and calls test1, test2 method

 

 

 



Guess you like

Origin www.cnblogs.com/datacenter/p/11447551.html