Dab tsi yog E hauv catch block?
Dab tsi yog E hauv catch block?

Video: Dab tsi yog E hauv catch block?

Video: Dab tsi yog E hauv catch block?
Video: Yog tsis sib hlub yuav zoo dab tsi? 2024, Kaum ib hlis
Anonim

' e ' tsuas yog parameter nws txhais tau tias catchblock tuaj yeem tau txais qhov kev sib cav thiab Cov Ntaub Ntawv hom kev sib cav isexception datatype.

Ua raws li qhov no hauv kev txiav txim siab, peb yuav txhais li cas thaiv thaiv?

"Tsim" thiab " ntes " yog cov lus tseem ceeb uas sawv cev rau kev tswj hwm ntawm kev zam vim cov ntaub ntawv lossis kev coding yuam kev thaum lub sijhawm ua haujlwm. thaiv yog cov thaiv ntawm code inwhexceptions tshwm sim. A ntes block catches thiab handlestry thaiv kev zam.

Tsis tas li ntawd, Java zam E yog dab tsi? Kev zam yog cov xwm txheej uas tshwm sim thaum lub sijhawm ua tiav ntawm cov kev pab cuam uas cuam tshuam qhov kev khiav dej num ntawm cov lus qhia (xws li faib los ntawm xoom, array nkag tawm ntawm kev khi, thiab lwm yam). Java , ib kev zam yog ib yam khoom uas wraps anerrorevent uas tshwm sim nyob rau hauv ib txoj kev thiab muaj: Cov ntaub ntawv hais txog qhov yuam kev nrog rau nws hom.

Ib tug kuj nug, koj siv sim ntes block li cas?

Muab cov nqe lus code uas yuav nce lossis pov tseg rau hauv a sim thaiv , thiab qhov chaw nqe lus siv los daws qhov kev zam lossis kev zam hauv ib lossis ntau dua catchblocks hauv qab no sim thaiv.

Lub hom phiaj ntawm qhov kawg thaiv yog dab tsi?

Cov thaum kawg thaiv ib txwm executes thaum thetry thaiv tawm. Qhov no xyuas kom meej tias cov thaum kawg thaiv raug rho tawm txawm tias muaj kev zam tsis tau tshwm sim. Tab sis thaum kawg muaj txiaj ntsig zoo rau ntau tshaj qhov tshwj xeeb tuav- nws tso cai rau tus programmer kom tsis txhob muaj kev ntxuav codeaccidentally bypassed los ntawm kev xa rov qab, txuas ntxiv, lossis tawg.

Pom zoo: