JAVA_經(jīng)典_基礎(chǔ)試題

JAVA_經(jīng)典_基礎(chǔ)試題

ID:37925948

大小:78.00 KB

頁(yè)數(shù):8頁(yè)

時(shí)間:2019-06-02

JAVA_經(jīng)典_基礎(chǔ)試題_第1頁(yè)
JAVA_經(jīng)典_基礎(chǔ)試題_第2頁(yè)
JAVA_經(jīng)典_基礎(chǔ)試題_第3頁(yè)
JAVA_經(jīng)典_基礎(chǔ)試題_第4頁(yè)
JAVA_經(jīng)典_基礎(chǔ)試題_第5頁(yè)
資源描述:

《JAVA_經(jīng)典_基礎(chǔ)試題》由會(huì)員上傳分享,免費(fèi)在線閱讀,更多相關(guān)內(nèi)容在教育資源-天天文庫(kù)

1、JAVA基礎(chǔ)考試題(請(qǐng)勿在此卷上填寫(xiě)答案,請(qǐng)將答案寫(xiě)在答題卡上,考試時(shí)間90分鐘,總分102分)一、選擇題(每題2分,共42分;錯(cuò)選不給分;少選給1分)1====1.publicclasstest{2.publicstaticvoidmain(Stringargs[]){3.inti=5;4.intj=i<<2;5.6.}7.}Whatisthedecimalvalueofjatline5?A.0B.1C.20D.-15E.Anerroratline3causescompilationtofail.F.Anerroratline4causescompilationtofail.2====

2、Integeri=newInteger(42);Longl=newLong(42);Doubled=newDouble(42.0);WhichexpressionsevaluatetoTrue?A.(i==l)B.(i==d)C.(d==l)D.(i.equals(d))E.(d.equals(i))F.(i.equals(42))G.None3====1.publicclasstest{2.privatestaticintj=0;3.4.privatestaticbooleanmethodB(intk){5.j+=k;6.returntrue;7.}8.9.publicstaticvo

3、idmethodA(inti){10.booleanb:11.b=i<10

4、methodB(4);12.b=i<10

5、

6、methodB(8);13.}14.15.publicstaticvoidmain(Stringargs[]){16.methodA(0);17.System.out.println(j);18.}819.}Whatistheresult?A.Theprogramprints"0"B.Theprogramprints"4"C.Theprogramprints"8"D.Theprogramprints"12"E.Thecodedoesnotcomplete4====1.p

7、ublicclassFoo{2.publicstaticvoidmain(String[]args){3.StringBuffera=newStringBuffer("A");4.StringBufferb=newStringBuffer("B");5.operate(a,b);6.system.out.println(a+","+b);7.}8.staticvoidoperate(StringBufferx,StringBuffery){9.x.append(y);10.y=x;11.}12.}Whatistheresult?A.Thecodecompilesandprints"A,B

8、".B.Thecodecompilesandprints"A,A".C.Thecodecompilesandprints"B,B".D.Thecodecompilesandprints"AB,B".E.Thecodecompilesandprints"AB,AB".F.Thecodedoesnotcompilebecause"+"cannotbeoverloadedforStringBuffer.5====1.publicclasstest{2.publicstaticvoidadd3(Integeri){3.intval=i.intValue();4.val+=3;5.i=newInt

9、eger(val);6.}7.8.publicstaticvoidmain(Stringargs[]){9.Integeri=newInteger(0);10.add3(i);11.System.out.println(i.intValue());12.}13.}Whatistheresult?A.Compilationwillfail.B.Theprogramprints"0".C.Theprogramprints"3".D.Compilationwillsucceedbutanexceptionwillbethrownatline3.6====1.publicclassConstOv

10、er{2.publicConstOver(intx,inty,intz){83.}4.}WhichtwooverloadtheConstOverconstructor?(ChooseTwo)A.ConstOver(){}B.protectedintConstOver(){}C.privateConstOver(bytex,bytey,bytez){}D.publicObjectConstOver(intx,inty,intz){}E

當(dāng)前文檔最多預(yù)覽五頁(yè),下載文檔查看全文

此文檔下載收益歸作者所有

當(dāng)前文檔最多預(yù)覽五頁(yè),下載文檔查看全文
溫馨提示:
1. 部分包含數(shù)學(xué)公式或PPT動(dòng)畫(huà)的文件,查看預(yù)覽時(shí)可能會(huì)顯示錯(cuò)亂或異常,文件下載后無(wú)此問(wèn)題,請(qǐng)放心下載。
2. 本文檔由用戶(hù)上傳,版權(quán)歸屬用戶(hù),天天文庫(kù)負(fù)責(zé)整理代發(fā)布。如果您對(duì)本文檔版權(quán)有爭(zhēng)議請(qǐng)及時(shí)聯(lián)系客服。
3. 下載前請(qǐng)仔細(xì)閱讀文檔內(nèi)容,確認(rèn)文檔內(nèi)容符合您的需求后進(jìn)行下載,若出現(xiàn)內(nèi)容與標(biāo)題不符可向本站投訴處理。
4. 下載文檔時(shí)可能由于網(wǎng)絡(luò)波動(dòng)等原因無(wú)法下載或下載錯(cuò)誤,付費(fèi)完成后未能成功下載的用戶(hù)請(qǐng)聯(lián)系客服處理。