Dab tsi yog qhov kev zam runtime hauv Java?
Dab tsi yog qhov kev zam runtime hauv Java?

Video: Dab tsi yog qhov kev zam runtime hauv Java?

Video: Dab tsi yog qhov kev zam runtime hauv Java?
Video: Poj niam hlub txiv ua dev ntis plhus 20.07.2018 2024, Kaum ib hlis
Anonim

Cov Runtime Exception yog niam txiv chav kawm nyob rau hauv tag nrho kev zam ntawm Java programming lus uas xav tias yuav poob lossis tawg qhov kev pab cuam lossis daim ntawv thov thaum lawv tshwm sim. Tsis zoo li kev zam uas tsis suav tias yog Runtime Exceptions , Runtime Exceptions yeej tsis kuaj.

Kuj paub, dab tsi yog runtime zam hauv Java nrog piv txwv?

Piv txwv rau RuntimeException yog kev ua haujlwm tsis raug cai cam khwb cia, siv tsis tsim nyog ntawm tus pointer null, referencing ib qho tawm ntawm bounds array element. yuam kev kev zam cov chav kawm qhia txog teeb meem tseem ceeb uas feem ntau tsis tuaj yeem daws los ntawm koj daim ntawv thov. Piv txwv yog tawm ntawm lub cim xeeb yuam kev, pawg overflow, tsis ua hauj lwm ntawm lub Java VM.

Tom qab ntawd, lo lus nug yog, qhov txawv ntawm qhov kev zam lub sijhawm ua haujlwm thiab qhov kev kuaj xyuas yog dab tsi? Main Qhov sib txawv ntawm RuntimeException thiab tshawb xyuas Exception yog tias, Nws yog qhov yuav tsum tau muab sim ntes lossis sim thaum kawg thaiv los daws kuaj Exception thiab tsis ua li ntawd yuav tshwm sim hauv compile lub sij hawm yuam kev, thaum hauv cas RuntimeException qhov no tsis yog yuav tsum tau.

Tib neeg kuj nug, koj puas tuaj yeem ntes lub sijhawm ua haujlwm tshwj xeeb hauv Java?

Catch Exception yuav ntes ob qho tib si kuaj thiab runtime kev zam . Runtime kev zam sawv cev rau cov teeb meem uas yog qhov tshwm sim ncaj qha ntawm qhov teeb meem programming, thiab xws li yuav tsum tsis txhob raug ntes vim nws ua tau ' tsis tsim nyog xav kom rov qab los ntawm lawv lossis tuav lawv. ntes Pov tau yuav ntes txhua yam.

Dab tsi yog qhov kev kuaj xyuas hauv Java?

A kuaj xyuas kev zam yog hom kev zam uas yuav tsum tau ntes los yog tshaj tawm nyob rau hauv txoj kev uas nws muab pov tseg. Piv txwv li, lub java ua .io. IOException yog ib kuaj xyuas kev zam . To taub dab tsi a kuaj xyuas kev zam yog, xav txog cov cai hauv qab no: Code tshooj 6.9: Unhandled kev zam.

Pom zoo: