Peb puas tuaj yeem txuas ntxiv cov chav kawm pov tseg hauv Java?
Peb puas tuaj yeem txuas ntxiv cov chav kawm pov tseg hauv Java?

Video: Peb puas tuaj yeem txuas ntxiv cov chav kawm pov tseg hauv Java?

Video: Peb puas tuaj yeem txuas ntxiv cov chav kawm pov tseg hauv Java?
Video: Nkauj tawm tshiab _QHov twg los tau _ by Xim vaj & Xeeb vwj & xis nus vaj _ (2020 - 2021 ) 2024, Kaum ib hlis
Anonim

Tag nrho cov khoom nyob rau hauv lub Java kev zam chav kawm hierarchy txuas ntxiv los ntawm Pov tau superclass. Tsuas yog piv txwv ntawm Pov tau (los yog ib qho khoom qub txeeg qub teg) raug cuam tshuam ncaj qha los ntawm Java Virtual Machine (JVM), los yog ua tau raug muab pov ncaj qha los ntawm cov lus pov tseg.

Tom qab ntawd, ib tus tuaj yeem nug, peb puas tuaj yeem txuas ntxiv kev ua yuam kev hauv Java?

Exception yog lub hauv paus kuaj kev zam chav kawm ; yuam kev thiab RuntimeException yog ob qho tib si tsis tau txheeb xyuas, thiab yog li tag nrho lawv cov subclasses. Koj yuav nco ntsoov tias tag nrho peb cov chav kawm txuas ntxiv mus Throwable, thiab javadoc rau Throwable hais tias: StackOverflowError ( extends yuam kev );

Ib tug kuj yuav nug, vim li cas throwable yog ib chav kawm tsis interface? Throwable yog ib chav kawm tsis interface pom hauv java. Li no Pov tau chav kawm yog niam txiv chav kawm ntawm txhua yam kev ua yuam kev thiab kev zam hauv Java lus. Cov khoom uas yog piv txwv ntawm no chav kawm (los yog ib tug ntawm nws tus me nyuam chav kawm ) tsuas yog muab pov los ntawm JVM lossis tuaj yeem cuam tshuam los ntawm Java pov nqe lus.

Tsuas yog li ntawd, dab tsi yog chav kawm pov tseg hauv Java?

lang. Cov chav kawm pov tseg yog superclass ntawm tag nrho cov yuam kev thiab kev zam nyob rau hauv lub Java lus. Tsuas yog cov khoom uas yog piv txwv ntawm qhov no chav kawm (los yog ib qho ntawm nws cov subclasses) raug pov los ntawm cov Java Lub tshuab virtual lossis tuaj yeem cuam tshuam los ntawm cov Java pov nqe lus.

Puas yog throwable yog subclass ntawm Exception?

Pov tau . Cov Pov tau chav kawm yog superclass ntawm txhua qhov yuam kev thiab kev zam hauv Java lus. Ib yam li ntawd, tsuas yog chav kawm no lossis ib qho ntawm nws subclass tuaj yeem yog hom kev sib cav nyob rau hauv ib qho catch clause. A Pov tau chav kawm muaj ib qho snapshot ntawm kev tua pawg ntawm nws cov xov thaum lub sijhawm nws tau tsim.

Pom zoo: