Immutable tuaj rau peb los ntawm Middle English los ntawm Latin immutabilis, lub ntsiab lus "tsis tuaj yeem hloov pauv." "Immutabilis" tau tsim los ntawm kev sib txuas cov lus tsis zoo ua ntej nrog "mutabilis," uas los ntawm Latin verb mutare thiab txhais tau tias "hloov." Qee lwm cov lus Askiv uas tuaj yeem taug qab mus rau "mutare" yog "commute" (tus …
Koj txhais li cas los ntawm kev hloov tsis tau hauv Python?
Ntau cov khoom python (booleans, integers, ntab, hlua, thiab tuples) yog hloov tsis tau. Qhov no txhais tau tias tom qab koj tsim cov khoom thiab muab qee tus nqi rau nws, koj tuaj yeem hloov tsis tau tus nqi ntawd. Definition Ib yam khoom uas hloov tsis tau yog ib yam khoom uas nws tus nqi hloov tsis tau.
Dab tsi yog qhov hloov tsis tau nrog piv txwv?
Rau los ntawm Basic Java thaum peb tham txog cov duab thaij duab uas qee yam khoom tsis hloov tau: ib zaug tsim, lawv ib txwm sawv cev rau tib tus nqi. … String yog ib qho piv txwv ntawm hom hloov tsis tau. Ib txoj hlua khoom ib txwm sawv cev rau tib txoj hlua. StringBuilder yog ib qho piv txwv ntawm hom mutable.
Koj txhais li cas los ntawm cov chav kawm tsis hloov?
Immutable class in java txhais tau tias thaum ib yam khoom raug tsim, peb hloov tsis tau nws cov ntsiab lus. Hauv Java, tag nrho cov chav kawm wrapper (xws li Integer, Boolean, Byte, Short) thiab String class tsis hloov tau. … Cov tswv cuab cov ntaub ntawv hauv chav kawm yuav tsum raug tshaj tawm tias yog qhov kawg kom peb tsis tuaj yeem hloov tus nqi ntawm nws tom qab tsim khoom.
Yuav ua li caskoj nkag siab los ntawm lo lus immutable chav kawm 11?
"immutable" txhais tau tias koj hloov tsis tau tus nqi. Yog tias koj muaj ib qho piv txwv ntawm String chav kawm, txhua txoj kev koj hu uas zoo li hloov pauv tus nqi, yuav tsim tau lwm txoj hlua.