下載本文檔
版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進行舉報或認(rèn)領(lǐng)
文檔簡介
1、選擇題 1: 1. whatwillhappenwhenyouattempttocompileandrunthefollowingcode? 2. 3. classbase 4. 5. 6. 7. inti=99; 8. 9. publicvoidamethod() 10. 11. 12. 13. system.out.println(base.amethod(); 14. 15. 16. 17. base() 18. 19. 20. 21. amethod(); 22. 23. 24. 25. 26. 27. publicclassderivedextendsbase 28. 29. 30.
2、 31. inti=-1; 32. 33. 34. 35. publicstaticvoidmain(stringargv) 36. 37. 38. 39. baseb=newderived(); 40. 41. system.out.println(b.i); 42. 43. b.amethod(); 44. 45. 46. 47. publicvoidamethod() 48. 49. 50. 51. system.out.println(derived.amethod(); 52. 53. 54. 55. 56. 57. choices:what will happen when you
3、 attempt to compile and run the following code? class base int i = 99; public void amethod() system.out.println(base.amethod(); base() amethod(); public class derived extends baseint i = -1; public static void main(string argv) base b = new derived(); system.out.println(b.i); b.amethod(); public voi
4、d amethod() system.out.println(derived.amethod(); choices:error! reference source not found.a.derived.amethod() -1 derived.amethod() error! reference source not found.b.derived.amethod() 99 error! reference source not found.c.compile time error error! reference source not found.d.derived.amethod() 2
5、:使用 jdbc 可以做到的是 error! reference source not found.a.把二進制代碼傳送到任何關(guān)系數(shù)據(jù)庫中 error! reference source not found.b.把 java 源代碼傳送到任何關(guān)系數(shù)據(jù)庫中 error! reference source not found.c.把表單信息傳送到任何關(guān)系數(shù)據(jù)庫中 error! reference source not found.d.很容易地把 sql 語句傳送到任何關(guān)系數(shù)據(jù)庫中 3: 1. strings=”examplestring”;whichoperationisnotlegal?stri
6、ng s=”example string”;which operation is not legal?error! reference source not found.a.int i=s.length(); error! reference source not found.b.s3=”x”; error! reference source not found.c.string short_s=s.trim(); error! reference source not found.d.string t=”root”+s; 4: 1. publicclassx 2. 3. publicobje
7、ctm() 4. 5. objecto=newfloat(3.14f);/line3 6. 7. objectoa=newobject1;/line4 8. 9. oa0=o;/line5 10. 11. o=null;/line6 12. 13. returnoa0;/line7 14. 15. 16. 17. 18. whenisthefloatobject,createdinline3,eligibleforgarbagecollection?public class x public object m() object o = new float(3.14f);/line 3 obje
8、ct oa = new object1;/line 4 oa0 = o;/line 5 o=null;/line 6 return oa0;/line 7 when is the float object, created in line 3,eligible for garbage collection?error! reference source not found.a.just after line 5. error! reference source not found.b.just after line 6 error! reference source not found.c.j
9、ust after line 7(that is,as the method returns) error! reference source not found.d.never in this method 5:which fragments are not correct in java source file? error! reference source not found.a.package testpackage; public class test/do something. error! reference source not found.b.import java.io.
10、*; package testpackage; public class test/ do something. error! reference source not found.c.import java.io.*; class person/ do something. public class test/ do something. error! reference source not found.d.import java.io.*; import java.awt.*; public class test/ do something. 6:在下述選項時,沒有構(gòu)成死循環(huán)的程序是 e
11、rror! reference source not found.a.int i=100 while (1) i=i%100+1; if (i100) break; error! reference source not found.b.for (;); error! reference source not found.c.int k=1000; do +k; while(k=10000); error! reference source not found.d.int s=36; while (s);-s; 7:which is the main() method return of a
12、application? error! reference source not found.a.string error! reference source not found.b.byte error! reference source not found.c.char error! reference source not found.d.void 8:use the operator “” and “”. which statement is true? error! reference source not found.a.1010 0000 0000 0000 0000 0000
13、0000 0000 4 give 0000 1010 0000 0000 0000 0000 0000 0000 error! reference source not found.b.1010 0000 0000 0000 0000 0000 0000 0000 4 give 1111 1010 0000 0000 0000 0000 0000 0000 error! reference source not found.c.1010 0000 0000 0000 0000 0000 0000 0000 4 give 0000 0000 0000 0000 0000 0000 0000 00
14、00 error! reference source not found.d.1010 0000 0000 0000 0000 0000 0000 0000 4 give 1111 1010 0000 0000 0000 0000 0000 0000 9: 1. whatwillhappenwhenyouattempttocompileandrunthefollowingcode? 2. 3. (assumethatthecodeiscompiledandrunwithassertionsenabled.) 4. 5. publicclassasserttest 6. 7. publicvoi
15、dmethoda(inti) 8. 9. asserti=0:methodb(); 10. 11. system.out.println(i); 12. 13. 14. 15. publicvoidmethodb() 16. 17. system.out.println(thevaluemustnotbenegative); 18. 19. 20. 21. publicstaticvoidmain(stringargs) 22. 23. asserttesttest=newasserttest(); 24. 25. test.methoda(-10); 26. 27.28. 29. 30. w
16、hat will happen when you attempt to compile and run the following code?(assume that the code is compiled and run with assertions enabled.)public class asserttestpublic void methoda(int i)assert i = 0 : methodb();system.out.println(i);public void methodb() system.out.println(the value must not be neg
17、ative);public static void main(string args)asserttest test = new asserttest();test.methoda(-10); error! reference source not found.a.it will print -10 error! reference source not found.b.it will result in assertionerror showing the message-“the value must not be negative”. error! reference source no
18、t found.c.the code will not compile. error! reference source not found.d.none of these. 10: 1. thefollowingcodeisentirecontentsofafilecalledexample.java,causespreciselyoneerrorduringcompilation: 2. classsubclassextendsbaseclass 3. 4. classbaseclass() 5. stringstr; 6. publicbaseclass() 7. system.out.
19、println(“ok”); 8. publicbaseclass(strings) 9. str=s; 10. publicclassexample 11. publicvoidmethod() 12. subclasss=newsubclass(“hello”); 13. baseclassb=newbaseclass(“world”); 14. 15. 16. 17. whichlinewouldbecausetheerror?the following code is entire contents of a file called example.java,causes precis
20、ely one error during compilation: class subclass extends baseclass class baseclass() string str; public baseclass() system.out.println(“ok”); public baseclass(string s) str=s; public class example public void method() subclass s=new subclass(“hello”); baseclass b=new baseclass(“world”); which line w
21、ould be cause the error? error! reference source not found.a.9 error! reference source not found.b.10 error! reference source not found.c.11 error! reference source not found.d.12 11:a class design requires that a member variable should be accessible only by same package, which modifer word should b
22、e used? error! reference source not found.a.protected error! reference source not found.b.public error! reference source not found.c.no modifer error! reference source not found.d.private 12:鑒于java的特點,它最適合的計算環(huán)境是 error! reference source not found.a.并行計算環(huán)境 error! reference source not found.b.分布式計算環(huán)境 e
23、rror! reference source not found.c.高強度計算環(huán)境 error! reference source not found.d.開放式計算環(huán)境 13:math.round(-11.5)等於多少? error! reference source not found.a.-11 error! reference source not found.b.-12 error! reference source not found.c.-11.5 error! reference source not found.d.none 14: 1. givethefollowingm
24、ethod: 2. publicvoidmethod() 3. stringa,b; 4. a=newstring(“helloworld”); 5. b=newstring(“gameover”); 6. system.out.println(a+b+”ok”); 7. a=null; 8. a=b; 9. system.out.println(a); 10. 11. intheabsenceofcompileroptimization,whichistheearliestpointtheobjectareferedisdefinitelyelibiletobegarbagecollection.give the following method: public void method( ) string a,b; a=new string(“hello world”); b=new string(“game over”); system.out.println(a+b+”ok”); a=null; a=b; system.out.println(a); in the absence of compiler optimization, whic
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 2026陜西黃河集團有限公司2026年校園招聘備考題庫及答案詳解(奪冠系列)
- 2026年可持續(xù)包裝解決方案指南
- 2026福建省水利投資開發(fā)集團有限公司招聘1人備考題庫及答案詳解(考點梳理)
- 城市公園水域環(huán)境管理手冊
- 汽車空調(diào)暖通系統(tǒng)設(shè)計手冊
- 2026湖南長沙市雅禮中南附屬中學(xué)春季非事業(yè)編制教師招聘備考題庫附答案詳解
- 2026湖南邵陽市邵東市市直事業(yè)單位引進博士研究生15人備考題庫及完整答案詳解
- 職業(yè)噪聲暴露的神經(jīng)遞質(zhì)與認(rèn)知
- 職業(yè)健康促進與職業(yè)健康標(biāo)準(zhǔn)引領(lǐng)
- 黑龍江2025年黑龍江省公安機關(guān)人民警察專項招錄(2810人)筆試歷年參考題庫附帶答案詳解
- 尼帕病毒病預(yù)防控制技術(shù)指南總結(jié)2026
- 2026屆大灣區(qū)普通高中畢業(yè)年級聯(lián)合上學(xué)期模擬考試(一)語文試題(含答案)(含解析)
- 2026國家國防科技工業(yè)局所屬事業(yè)單位第一批招聘62人備考題庫及完整答案詳解一套
- 道路隔離護欄施工方案
- (2025年)軍隊文職考試面試真題及答案
- 新版-八年級上冊數(shù)學(xué)期末復(fù)習(xí)計算題15天沖刺練習(xí)(含答案)
- 2025智慧城市低空應(yīng)用人工智能安全白皮書
- 云南師大附中2026屆高三月考試卷(七)地理
- 通信管道施工質(zhì)量控制方案
- 仁愛科普版(2024)八年級上冊英語Unit1~Unit6單元話題作文練習(xí)題(含答案+范文)
- 安徽寧馬投資有限責(zé)任公司2025年招聘派遣制工作人員考試筆試模擬試題及答案解析
評論
0/150
提交評論