Dab tsi yog qhov kev siv ntawm no thiab super lo lus tseem ceeb hauv Java?
Dab tsi yog qhov kev siv ntawm no thiab super lo lus tseem ceeb hauv Java?

Video: Dab tsi yog qhov kev siv ntawm no thiab super lo lus tseem ceeb hauv Java?

Video: Dab tsi yog qhov kev siv ntawm no thiab super lo lus tseem ceeb hauv Java?
Video: Ntsaim Vaj - Tsis Tshuav Dab Tsis Zoo Lawm (New Official MV 2023) 2024, Kaum ib hlis
Anonim

super thiab qhov no keywords hauv Java . super lo lus tseem ceeb yog siv nkag mus rau cov txheej txheem ntawm niam txiv chav kawm thaum qhov no yog siv nkag mus rau cov txheej txheem ntawm chav kawm tam sim no. qhov no yog ib tug reserved lo lus tseem ceeb hauv java i.e, peb ua tsis tau siv nws ua tus cim. qhov no yog siv xa mus rau cov chav kawm tam sim no nrog rau cov tswv cuab zoo li qub.

Ntxiv mus, dab tsi yog kev siv super lo lus tseem ceeb hauv Java nrog piv txwv?

1) super yog siv xa mus rau tam sim niam txiv chav piv txwv piv txwv. Peb ua tau siv super lo lus tseem ceeb mus saib tau cov ntaub ntawv tus tswv cuab los yog teb ntawm niam txiv chav kawm. Nws yog siv yog cov niam txiv thiab cov menyuam kawm ntawv muaj tib lub teb. Nyob rau saum toj piv txwv , Tsiaj thiab Aub ob chav kawm muaj cov khoom sib xws.

Tsis tas li ntawd, qhov txawv ntawm qhov no thiab super lo lus tseem ceeb hauv Java yog dab tsi? qhov no thiab super yog ob lub ntsiab lus tshwj xeeb hauv Java , uas yog siv los sawv cev piv txwv tam sim no ntawm chav kawm thiab nws super chav kawm. Raws li kuv hais hauv thawj kab, lub ntsiab qhov txawv ntawm qhov no thiab super hauv Java yog tias qhov no sawv cev rau qhov piv txwv tam sim no ntawm chav kawm, thaum super sawv cev piv txwv tam sim no ntawm niam txiv chav kawm.

Raws li, siv lo lus tseem ceeb no hauv Java yog dab tsi?

Lo lus tseem ceeb 'THIS' in Java yog ib qho kev hloov pauv uas hais txog cov khoom tam sim no. "qhov no" yog siv rau cov khoom tam sim no, uas nws txoj kev raug hu ua. Koj ua tau siv "qhov no" lo lus tseem ceeb kom tsis txhob muaj npe tsis sib haum xeeb hauv txoj kev / tus tsim ntawm koj qhov piv txwv / khoom.

Lub hom phiaj ntawm super hauv Java yog dab tsi?

Txhais thiab siv The super lo lus tseem ceeb hais txog superclass (niam txiv) cov khoom. Nws yog siv los hu rau superclass txoj kev, thiab nkag mus rau lub superclass constructor. Feem ntau siv cov super lo lus tseem ceeb yog tshem tawm qhov tsis meej pem ntawm superclasses thiab subclasses uas muaj cov txheej txheem nrog tib lub npe.

Pom zoo: