Section E.19. Exceptions

   

E.19 Exceptions

Declare an exception to be thrown as shown below:

 public void someMethod() throws Exception {     if(somethingBad) {     throw new Exception();     } } 

Catch an exception as shown below:

 public void someMethod() {     // code for an operation that could cause an exception...     try {     // ...some code     }     catch(Exception e) {     // exception handling code here     }     finally {     // this code executes whether an exception was     // thrown or not     } } 

   
Top


Java for ColdFusion Developers
Java for ColdFusion Developers
ISBN: 0130461806
EAN: 2147483647
Year: 2005
Pages: 206
Authors: Eben Hewitt

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net