??????飺????????java??????????????????Three Rules for effective Exception Handling?????????????????????????????????debug??????н???????????????

????????????

?????????????

???????????

????java???????????????????????????????????????????Thinking in java????????Bruce Eckel????????????????????java?е??????????Error??Exception??????????????????????????????Throwable??Error????JVM?????з??????Щ????????????????????????????????ЩError???????????????????StackOverflowError?????????????????????????????????????????????????JVM????Exception?????????????????Щ??????????????????????????????????????????????????????????Exception????????????????checked????δ????????unchecked???????????????????????????????????????try..catch??????????????????????????????????Щ?????????????????? NullPointerException ??????????????????RuntimeException??java?????????????????????????ü???????????????sun????????????????checked????unchecked????????????????????????java?????????????????

???????????

?????????????java???Щ?????????????????????????????Щ?????????IOException??SQLException?????Щ?????????????????????????????????????????в?????????????????try..catch??????????????????д?????????????try??????д????????????????????catch?????н??в??????????catch?????д???????Exception????????ζ??????????????????е??????????????????????????д??????????????finally???????????У?????????????洦???Щ????????????????????????????????????????

????????????????????????????try??????е??catch??finally??????????????????catche???????????ж?????????try?????п????????????????????????????????д???catch???????????????????????????д?????£?


1.try{ 
2.    // ..invoke some methods that may throw exceptions
3.}catch(ExceptionType1 e){ 
4.    //...handle exception
5.}catch(ExceptionType2 e){ 
6.    //...handle exception
7.}catch(Exception e){ 
8.    //...handle exception
9.}finally{ 
10.    //..do some cleaning :close the file db etc.
11.}
 


???????????????????type?????exception??????????????????д?????????switch case????????????????????????catch???????????????????????е??????break??case?????????????catch??Exception??????д????棬catch?????????????????Exception?????????????????

??????????try..catch?????????????????????????????????????“3????”???????????????????????????try??????????е??????????????????????????????????·????????????ó????????fillInStackTrace()??Throwable????????????????????????????????????????????????????????????StackOverFlow???????й???η???????????????? ???????????try?????????????????????????????????????????????Ч???goto??????????????????????????????д????????????

????????????????????try catch??????????????????Ч???????????????????á?