????????????
????????exception??????????????exceptional event??????д??
?????????壺??????????????????????????????ж???????е??????????????????
????????????????з????????????????????????????????????????????????????????????????????????????й????????????Щ??????????????????????????????????????????????????????????????????????????????
???????????????????????????????????Щ????????????????Щ?????????????????????????????????????б????Щ????????????????????????á?????????б??????????????call??stack??
??????????????????????????????????????????????????????????????????????????????????????????????????????÷???????????????? ????????????????????????????????????????????????????????????????????????????????????????????????????????????????? ???????????????????????????????????????????????????????е???????????????????????????????
???????????????
?????κε???????Throwable????β??????????????????????°???????????Error / Exception????Error???????Java??????з?????????????????????λ???????Java???????????Error???????????? ????????????Errors????????????????????????????Error????????????????????Exception
????Exception?б?????????RuntimeException????????????????????????????????????κε???????????????????????????????????????????????????????????????????????RuntimeException
????A method is not required to declare in its throws clause any subclasses of RuntimeException that might be thrown during the execution of the method but not caught.
??????????????з???????????δ??????? RuntimeException ???κ??????????? throws ????н?????????
????? ???????????ò??“????”?????????????????ε????????????????????????????RuntimeException?????????ù??? Error??????????????RuntimeException????????????????????????????????????????Σ???<B>??????????? ???Error????JVM?????????????;RuntimeException?????????????????;checked exception ?????????????????</B>??
??????????????????ù??????????????Error?? RuntimeException????????μ??????????????????????Щ????????Checked Exception??????Error??RuntimeException??????Unchecked Exception.
?????????????Щ??????????????????????????????????о????е????????е??????????????????????????????????????????J2EE??????????
?????????????J2EE?????
??????????????????????????????????????????????????????doBusiness()????????
????public void doBusiness() throws xxxBusinessException
???????????????????????????????????????????????????RuntimeException ?? checked exception??
????????????????????????????????е???????y?RuntimeException????????????????????????????н?????????????Σ?
?????????????Struts?е????Action???????????????doExecute(....)?????doBusiness()???????
public void doAction(......)
{
try
{
xxx.doBusiness();
}
catch(Exception e)
{
if(e instanceof RuntimeException)
{
// catch runtime exception
// ?????????????????RuntimeException
// ???????????????????????????????????
// ?????????????????
}else
{
//checked exception such as xxxBusinessException
//?????????????????????
}
}
}