Dab tsi yog ob chav kawm tshwj xeeb hauv hierarchy ntawm Java zam chav kawm?
Dab tsi yog ob chav kawm tshwj xeeb hauv hierarchy ntawm Java zam chav kawm?

Video: Dab tsi yog ob chav kawm tshwj xeeb hauv hierarchy ntawm Java zam chav kawm?

Video: Dab tsi yog ob chav kawm tshwj xeeb hauv hierarchy ntawm Java zam chav kawm?
Video: tos koj hauv nruab dab - nuj xeem - nkauj tawm tshiab fullMV 2021 2024, Kaum ib hlis
Anonim

Cov Chav kawm tshwj xeeb muaj ob subclasses tseem ceeb: IOException chav kawm thiab RuntimeException Chav kawm . Hauv qab no yog ib daim ntawv teev cov feem ntau kuaj xyuas thiab tsis tau txheeb xyuas Java cov Ua-hauv Kev zam.

Kuj paub, dab tsi yog qhov tshwj xeeb hierarchy hauv Java?

Exception Hierarchy Txhua qhov kev zam thiab qhov yuam kev yog cov chav kawm ntawm chav kawm Throwable, uas yog lub hauv paus chav kawm ntawm hierarchy. Ib ceg yog coj los ntawm Exception. Qhov no chav kawm yog siv rau tshwj xeeb tej yam kev mob uas cov neeg siv cov kev pab cuam yuav tsum tau ntes. NullPointerException yog ib qho piv txwv ntawm qhov kev zam.

Ib tug kuj nug, dab tsi yog ob hom kev zam hauv Java? Muaj feem ntau ob hom kev zam : checked thiab unchecked. Ntawm no, qhov yuam kev yog suav tias yog qhov tsis tau txheeb xyuas kev zam.

Ib yam li ntawd, koj tuaj yeem nug, dab tsi yog superclass ntawm tag nrho cov chav kawm tshwj xeeb hauv Java?

Throwable: Tus Throwable chav kawm yog cov superclass ntawm tag nrho cov yuam kev thiab kev zam hauv 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.

Qhov twg yog lub hauv paus chav kawm ntawm Java kev zam hierarchy?

Cov kev zam uas tau tshwm sim hauv Java program raug teeb tsa hauv hierarchy ntawm cov chav kawm tshwj xeeb. Throwable class, uas yog ib qho subclass tam sim ntawd Yam khoom , yog nyob rau hauv lub hauv paus ntawm kev zam hierarchy. Throwable muaj ob lub subclasses tam sim no: Kev zam thiab yuam kev.

Pom zoo: