Puas khaws cov khoom qub qub?

Cov txheej txheem:

Puas khaws cov khoom qub qub?
Puas khaws cov khoom qub qub?

Video: Puas khaws cov khoom qub qub?

Video: Puas khaws cov khoom qub qub?
Video: qub qub tsw tsw / zoo xyooj C.V 2024, Hlis ntuj nqeg
Anonim

Cov khoom sau yog lub moj khaum siv los khaws thiab tswj hwm ib pawg ntawm cov khoom. Java Collection txhais tau hais tias ib chav tsev ntawm cov khoom. Txij li ob nqe lus saum toj no muaj tseeb, generic Java collections tsis tuaj yeem khaws cov hom qub ncaj qha.

Can List store primitive type?

ArrayList tsis tuaj yeem tuav cov ntaub ntawv keeb kwm yav dhau los xws li int, ob npaug, char, thiab ntev. Nrog rau kev taw qhia rau cov chav kawm qhwv hauv java uas tau tsim los tuav cov ntaub ntawv tseem ceeb. Cov khoom ntawm cov hom no tuav ib tus nqi ntawm lawv cov hom qub (int, ob, luv, byte).

Yam khoom twg khaws cia hauv hom ntaub ntawv qub?

Java muaj 8 cov ntaub ntawv keeb kwm yav dhau los xws li byte, luv, int, ntev, ntab, ob npaug, char thiab boolean. Thaum ib hom ntaub ntawv tseem ceeb khaws cia, nws yog pawguas cov txiaj ntsig yuav raug muab.

Can array khaws cov ntaub ntawv qub qub?

Java arrays tuaj yeem khaws cov hom qub thiab strings, tab sis tsis tuaj yeem khaws lwm yam khoom uas tsis yog Strings.

Koj puas khaws cov khoom qub hauv Hashmap?

No data structure List, Set, Map store primitives. rau koj cov lus teb koj muaj peev xwm tsim array ntawm primitive hom raws li array kuj yog cov ntaub ntawv qauv thiab ces koj muaj peev xwm muab cov array mus sau, teem los yog daim ntawv qhia yam puas tau koj xaiv.

Pom zoo: