2016-06-30
1 Getting exception information
When an exception occurs, the program executes directly from the try to the catch statement block, and no longer continues execution.
Packagecom.java1995;//End Method//return;//End Program//system.exit (0); Public classTrycatchtest { Public Static voidMain (string[] args) {intCount=9; Try{ //int temp=count/0;//int[] Arr=new int[]{1,2,3,4,5}; //int temp=arr[90];String a= "AAA"; Integer.parseint (a); System.out.println ("Detection program ..."); }Catch(ArithmeticException e) {System.out.println ("A ArithmeticException exception has occurred."); }Catch(arrayindexoutofboundsexception e) {System.out.println ("A arrayindexoutofboundsexception exception has occurred."); }Catch(Exception e) {System.out.println ("All the anomalies will be captured by me."); } finally{System.out.println ("Finally"); } System.out.println ("Program Run End"); } }
Resources
[1] Java Easy Start Classic tutorial "full version"
Java section 47th getting exception information