Peb puas tuaj yeem siv cov txheej txheem deprecated hauv Java?
Peb puas tuaj yeem siv cov txheej txheem deprecated hauv Java?

Video: Peb puas tuaj yeem siv cov txheej txheem deprecated hauv Java?

Video: Peb puas tuaj yeem siv cov txheej txheem deprecated hauv Java?
Video: Qhia txog peb hmoob Kev cai txheej txheem kab tshoob Kev Kos thiab hais zaj. 2019-2020 2024, Kaum ib hlis
Anonim

Tib yam rau Java cov @ Deprecated -koj ua tau tseem siv tus txoj kev , tab sis ntawm koj tus kheej qhov kev pheej hmoo - yav tom ntej, nws yuav muaj lwm txoj hauv kev zoo dua, thiab tej zaum yuav tsis tau txais kev txhawb nqa. Yog koj siv kod yog tsis pom zoo , nws feem ntau zoo, tsuav koj tsis tas yuav hloov mus rau API tshiab - qhov tsis pom zoo code tej zaum yuav tsis muaj nyob ntawd.

Tsuas yog li ntawd, nws txhais li cas rau ib txoj hauv kev kom deprecated?

Ib yam li ntawd, thaum ib chav kawm lossis txoj kev yog deprecated , nws txhais tau tias tias class or txoj kev yog tsis suav tias tseem ceeb lawm. Nws yog yog li tsis tseem ceeb, qhov tseeb, uas nws yuav tsum tsis tau siv lawm, vim nws yuav zoo tso tseg yav tom ntej. Qhov xav tau kev txiav txim siab los txog vim tias raws li chav kawm hloov zuj zus, nws cov API hloov.

Kuj Paub, puas yog deprecated lossis depreciated? Cov kab hauv qab: rau tso tseg yog "tsis pom zoo," tab sis hauv "tus kheej- deprecating ,”nws txhais tau tias, “raug saib tsis taus.” Hauv ntiaj teb kev suav, tsis pom zoo txhais tau tias "phased tawm" los yog "sai yuav phased tawm." Depreciate yog tham txog kev poob nyiaj txiag.

Hais txog qhov no, puas yog deprecated yuav siv?

Nws yog ib qho tseem ceeb los taw qhia tias " tsis pom zoo " ua tsis tas txhais tau tias muaj nuj nqi yuav tso tseg los yog ua hauj lwm nyob rau hauv ib tug tshiab version. Nws yuav nyob twj ywm ua haujlwm thiab ib feem ntawm lub tsev qiv ntawv rau lub neej ntawm lub tsev qiv ntawv. Txawm li cas los xij, nws yog kev coj tsis zoo rau siv deprecated ua haujlwm hauv cov cai tshiab.

Vim li cas hnub tsis pom zoo hauv Java?

Ib tug yog vim li cas constructor tsis pom zoo yog tias lub ntsiab lus ntawm lub xyoo parameter tsis yog qhov koj xav tau. javadoc hais tias: Raws li ntawm JDK version 1.1, hloov los ntawm Calendar. set(xyoo + 1900, hli, hnub ).

Pom zoo: