Dab tsi yog abstraction hauv Java nrog lub sijhawm piv txwv?
Dab tsi yog abstraction hauv Java nrog lub sijhawm piv txwv?

Video: Dab tsi yog abstraction hauv Java nrog lub sijhawm piv txwv?

Video: Dab tsi yog abstraction hauv Java nrog lub sijhawm piv txwv?
Video: ABSTRACT PAINTING 001 my first abstract painting 2024, Kaum ib hlis
Anonim

Lwm tus tiag lub neej piv txwv ntawm Abstraction yog lub tshuab ATM; Txhua tus ua haujlwm ntawm lub tshuab ATM xws li rho nyiaj ntsuab, hloov nyiaj, khaws cov nqe lus me me… thiab lwm yam. tab sis peb tsis tuaj yeem paub cov ntsiab lus sab hauv ntawm ATM. Nco tseg: Cov ntaub ntawv abstraction tuaj yeem siv los muab kev ruaj ntseg rau cov ntaub ntawv los ntawm cov txheej txheem tsis tau tso cai.

Kuj nug, dab tsi yog abstraction hauv Java nrog piv txwv?

Hauv cov lus yooj yooj yim, koj tuaj yeem txhais abstraction uas captures tsuas yog cov ntsiab lus hais txog a Java khoom uas muaj feem xyuam rau qhov kev xav tam sim no. Rau piv txwv , HashMap khaws cov khub tseem ceeb. Nws muab ob txoj hauv kev rau koj tau txais() thiab tso() txoj hauv kev los khaws thiab khaws cov nqi tseem ceeb ntawm daim ntawv qhia.

qhov twg abstraction siv nyob rau hauv Java? Hauv java ua , abstraction yog tiav los ntawm interfaces thiab abstract chav kawm. Peb tuaj yeem ua tiav 100% abstraction siv interfaces. Abstract chav kawm thiab Abstract method: ib abstract chav kawm yog ib chav kawm uas tau tshaj tawm nrog abstract lo lus tseem ceeb.

Ib sab ntawm qhov no, piv txwv li cas ntawm abstraction?

Lub ntsiab txhais ntawm abstraction yog ib lub tswv yim uas tsis muaj qhov xwm txheej, lossis yog qhov zoo tshaj plaws hauv qhov xwm txheej. Piv txwv ntawm abstractions tuaj yeem yog kev xav xws li kev tu siab lossis kev zoo siab. Ib piv txwv ntawm abstraction yog thaum koj cov nyiaj txiag yuav tswj koj cov kev xav thiab tiv thaiv koj los ntawm kev tsom mus rau lwm cov tswv yim lossis kev ua haujlwm.

Yuav siv abstraction li cas hauv lub neej txhua hnub?

Tib neeg siv abstraction txheej hauv lub neej txhua hnub . Lub qhov rooj xauv muab ib qho abstraction uas ua rau peb muaj peev xwm txwv tsis pub nkag mus rau ib chav. Txawm tias cov neeg, uas tsis paub yuav ua li cas lub cuab yeej siv tau, tuaj yeem nkag siab nws lub hom phiaj thiab tuaj yeem siv tau.

Pom zoo: