Dab tsi yog chav kawm paub daws teeb meem hauv Java tutorial point?
Dab tsi yog chav kawm paub daws teeb meem hauv Java tutorial point?

Video: Dab tsi yog chav kawm paub daws teeb meem hauv Java tutorial point?

Video: Dab tsi yog chav kawm paub daws teeb meem hauv Java tutorial point?
Video: 5 Yam: Txhob pub muaj nyob hauv Tsev (Tsis Zoo) 2024, Kaum ib hlis
Anonim

A chav kawm uas muaj cov abstract lo lus tseem ceeb hauv nws cov lus tshaj tawm yog hu ua chav kawm abstract . Yog ib chav kawm tau tshaj tawm abstract , nws tsis tuaj yeem instantiated. Yuav siv ib chav kawm abstract , koj yuav tsum tau txais nws los ntawm lwm tus chav kawm , muab kev siv ntawm cov abstract txoj kev hauv nws.

Tsis tas li ntawd, kev siv cov chav kawm paub daws teeb meem hauv Java yog dab tsi?

abstract lo lus tseem ceeb yog siv tsim ib chav kawm abstract thiab txoj kev. Abstract class in java ua tsis tau instantiated. Ib chav kawm abstract yog feem ntau siv los muab lub hauv paus rau subclasses kom txuas ntxiv thiab siv cov abstract txoj kev thiab override los yog siv cov txheej txheem siv nyob rau hauv chav kawm abstract.

Qhov thib ob, dab tsi yog txhais los ntawm chav kawm abstract hauv Java? Ib chav kawm abstract , nyob rau hauv cov ntsiab lus ntawm Java , yog superclass uas tsis tuaj yeem instantiated thiab siv los hais lossis txhais yam ntxwv dav dav. Ib yam khoom tsis tuaj yeem tsim los ntawm a Java abstract class ; sim instantiate ib chav kawm abstract tsuas yog tsim ib qho yuam kev compiler.

Kuj nug, dab tsi yog chav kawm abstract thiab txoj kev hauv Java?

Java Abstract Classes thiab Methods Abstract class : yog txwv chav kawm uas tsis tuaj yeem siv los tsim khoom (kom nkag mus rau nws, nws yuav tsum tau txais los ntawm lwm tus chav kawm ). Abstract method : tsuas yog siv tau rau hauv ib qho chav kawm abstract , thiab nws tsis muaj lub cev. Lub cev yog muab los ntawm subclass (kwv yees los ntawm).

Dab tsi yog qhov ntsiab lus ntawm cov chav kawm abstract?

Lub hom phiaj ntawm ib chav kawm abstract yog los txhais qee tus cwj pwm uas tuaj yeem tau txais los ntawm ntau lub subclasses, tsis tas siv tag nrho chav kawm . Hauv C#, lub abstract lo lus tseem ceeb xaiv ob qho tib si chav kawm abstract thiab ib txoj kev ntshiab virtual.

Pom zoo: