@SneakyThrows tuaj yeem siv los zais pov tseg cov kev zamyam tsis tau tshaj tawm qhov no hauv koj txoj kev cuam tshuam. Qhov peev xwm sib cav me ntsis no yuav tsum tau siv ua tib zoo, tau kawg.
Yuav ua li cas koj daws qhov zam yam tsis cuam tshuam?
Tsuas siv sim ntes thaiv thiab mus, yog tias qhov kev zam tsis tseem ceeb thiab tsis cuam tshuam rau kev coj cwj pwm ntawm koj qhov kev pab cuam. Koj tuaj yeem zam tsis tau qhov kev zam, tab sis yog tias muaj qhov tshwj xeeb pov thiab koj tsis ntes nws koj qhov kev zov me nyuam yuav tso tseg (kev sib tsoo). Tsis muaj txoj hauv kev los tsis quav ntsej qhov kev zam.
Kev kuaj xyuas yog dab tsi?
Ib qho kev kuaj xyuas yog ib hom kev zam uas yuav tsum tau ntes lossis tshaj tawm hauv txoj kev uas nws muab pov tseg. Piv txwv li, java.io. IOException yog ib qho kev kuaj xyuas.
Dab tsi yog qhov txawv ntawm kev kuaj xyuas thiab tsis kuaj xyuas?
1) Tshawb xyuas: yog qhov tshwj xeeb uas tau kuaj xyuas thaum muab tso ua ke. Yog tias qee qhov chaws hauv ib txoj kev cuam tshuam qhov kev kuaj xyuas, ces txoj kev yuav tsum tau ua qhov kev zam lossis nws yuav tsum qhia qhov kev zam uas siv cov lus tseem ceeb pov tseg. … 2) Unchecked is the exceptions that are not checked at compiled time.
Puas yog runtime kev zam yog subclass ntawm kev zam?
RuntimeException yog superclass ntawm cov kev zam uas tuaj yeem cuam tshuam thaum lub sijhawm ua haujlwm ntawm Java Virtual Machine. RuntimeException thiab nws cov subclasses yogunchecked exceptions.