


版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡介
1、1. Which two demonstrate an is a relationship? (Choose Two)A. public interface Person public class Employee extends Person B. public interface Shape public class Employee extends Sha pe C. public interface Color public class Employee extends Color D. public class Species public class Animalprivate S
2、pecies species;E. interface Component Class Container implements Component (Private Component children;Answer:de2. Given:1. package foo;2.2. public class Outer (3. public static class Inner (5-)6. )Which statement is true?A. An instance of the Inner class can be constructed with new Outer.lnner ()B.
3、 An instance of the inner class cannot be constructed outside of package fooC. An instance of the inner class can only be constructed from within the outer classD. From within the package bar, an instance of the inner class can be constructed with new inner 。Answer:c3. Exhibit :1 public class enclos
4、inggone2 public class insideone34 public class inertest5 public static void main (String args)6 enclosingone eo = new enclosingone();7 /insert code here8Which statement at line 7 constructs an instance of the inner class?A. InsideOne ei = eo.new lnsideOne();B. B. Eo.InsideOne ei = eo.new lnsideOne()
5、;C InsideOne ei = EnclosingOne.new lnsideOne();D.EnclosingOne InsideOne ei = eo.new lnsideOne();Answer:aC. 4.D. 1) class SuperE. 2) public float getNum()return 3.Of;F. 3) G. 4)H. 5) public class Sub extends SuperI. 6)J. 7) K. which method, placed at line 6, will cause a compiler error?L. A. public f
6、loat getNum()return 4.Of;M. B. public void getNum()N. C. public void getNum(double d)O. D. public double getNum(float d)return 4.0d;Answer:B5.1) public class Foo2) public static void main(String args)3) tryreturn;4) finally System.out.println(Finally);5) 6) what is the result?A. The program runs and
7、 prints nothing.B. The program runs and prints Tinally.C. The code compiles, but an exception is thrown at runtime.D. The code will not compile because the catch block is missing.Answer:b6./point X public class Foopublic static void main(String args)Printwriter out=new PrintWriter(new java.io.Output
8、StreamWriter(System.out),true);out.println(Hello);which statement at point X on line 1 allows this code to compile and run?A. import java.io.PrintwriterB.includeC. import java.io.OutputStreamWriter D.includeE. No statement is neededAnswer:a7. which three are valid declaraction of a float?A. float fo
9、o=-1;B. float foo=1.0;C. float foo=42e1;D. float foo=2.02f;E. float foo=3.03d;F. float foo=0x0123;Answer:adfint index=1; int foo=new int3; int bar=fooindex;int baz=bar+index; what is the result?A. baz has a value of 0B. baz has value of 1C. baz has value of 2D. an exception is thrownE. the code will
10、 not compileAnswer:b9.1) int i=1,j=10;2) do3) if(i+-j) continue; 192837464) while(ij)continue;j; while(+i6); what are the vale of i and j?A. i=6,j=5B. i=5,j=5C. i=6,j=4D. i=5,j=6E. i=6,j=6Answer: A20.byte array 1 ,array2 byte array3 byte array4if each has been initialized, which statement will cause
11、 a compile error?A. array2 = array 1;B. array2 = array3;C. array2 = array4;D. both A and BE. both A and CF. both B and CAnswer: a21.which four types of objects can be thrown use throws?A. ErrorB. EventC. ObjectD. ExcptionE. ThrowableF. RuntimeExceptionAnswer: A,D,E, F22.1) public class Test2) public
12、 static void main(String args)3) unsigned byte b=0;4) b-;5)5) 6) what is the value of b at line 5?A. -1 B.255 C.127 D.compile fail E.compile succeeded but run errorAnswer: d23.public class ExceptionTestclass TestExcepti on exte nds Excepti onpublic void runTest() throws TestExceptionpublic void test
13、() /* point x */ runTest();At point x, which code can be add on to make the code compile?A. throws ExceptionB. catch (Exception e)C. throws RuntimeExceptionD. catch (TestException e)E. no code is necessaryAnswer: A24.String foo=blue;boolean bar=new boolean1;if(barO) foo=green;what is the value of fo
14、o?A. B.null C.blue D.greenAnswer: C25.which two are equivalent?3/2323*43?23*2A3?10&methodB(1);10. b=i10&methodB(2);11. 14.12. public static void main(String args) 13. methodA(O);17.14. 15. What is the value of j at line 17?A. 0B. 1C. 2D. 3E. The code will not compile.Answer: B43.public class Testpub
15、lic static void main(String args) String foo=blue;4) String bar=foo;5) foo=green;6) System.out.println(bar);what is the result?A. An exception is thrown.B. The code will not compile.C. The program prints null.D. The program prints blue.E. The program prints green.Answer: D44.class Apublic int getNum
16、ber(int a)return a+1;class B extends Apublic int getNumber(int a, char c)return a+2;public static void main(String args)B b=new B();14) System.out.println(b.getNumber(0);what is the result?A. compilation succeeds and 1 is printedB. compilation succeeds and 2 is printedC. An error at line 8 cause com
17、pilation to failD. An error at line 14 cause compilation to failAnswer: a45.You are assigned the task of building a Panel containing a TextArea at the top, a Labbel directly bellow it, and a Button directly bellow the Label. If the three components added directly to the Panel, which layout manager c
18、an the Panel use to ensure that the TextArea absorbs all of the free vertical space when the Panel is resized?A.GridLayoutB.CardLayoutC.FIowLayoutD.BorderLayoutE.GridbagLayoutAnswer: e46.which two are true to describe an entire encapsulation class?A. member data have no access modifiersB. member dat
19、a can be modified directlyC. the access modifier for methods is protectedD. the access modifier to member data is privateE. methods provide for access and modification of dataAnswer: d,e47.public class X implements Runnablepublic static void main(String args)3) /insert codepublic void run()int x=0,y
20、=0;for(;)x+;Y+;System.out.println(x=+x+,y=+y);You want to cause execution of the run method in a new thread of execution.Which line(s) should be added to the main method at line 3?A. X x=new X();x.run();B. X x=new X();new Thread(x).run();C. X x=new X();new Thread(x).start();D. Thread t=new Thread(x)
21、.run();E. Thread t=new Thread(x).start();Answer: a,c48.which gets the name of the parent directory of file file.txt?A. String name=File.getParentName(file.txt);B. String name=(new File(file.txt).getParent();C. String name=(new File(file.txt).getParentName();D. String name=(new File(file.txt).getPare
22、ntFile();E. Diretory dir=(new File(file.txt).getParentDir();String name=dir.getName();Answer: b49.The file file.txt exists on the file system and contains ASCII text. tryFile f=new File(file.txt);Outputstream out=new FileOutputStream(f);catch (lOException e)A. the code does not compileB. the code ru
23、ns and no change is made to the fileC. the code runs and sets the length of the file to 0D. An exception is thrown because the file is not closedE. the code runs and deletes the file from the file systemAnswer: c50.The file file.txt exists on the file system and contains ASCII text. Given:38. try 39
24、. File f = new File( file.txt);40. Outputstream out = new FileOutputStream(f, true);41. 42. catch (lOException) What is the result?A. The code does not compile.B. The code runs and no change is made to the file.C. The code runs and sets the length of the file to 0.D. An exception is thrown because t
25、he file is not closed.E. The code runs and deletes the file from the file system.Answer:A51.import java.io.lOException;public class ExceptionTestpublic static void main(String args)trymethodA();catch(IOException e)System.out.println(Caught Exception);public void methodA()throw new IOException();what
26、 is the result?A. The code will not compileB. The output is Caught ExceptionC. The output is Caught lOExceptionD. The program executes normally without printing a messageAnswer: a52.Which two can directly cause a thread to stop executing? (Choose Two)A. Exiting from a synchronized block.B. Calling t
27、he wait method on an object.C. Calling the notify method on an object.D. Calling the notifyAII method on an object.E. Calling the setPriority method on a thread object.Answer: B, E53.You need to store elements in a collection that guarantees that no duplicates are stored and all elements can be access in nature order, which interace provides that capability?A.B.C.D. java.utiLSortedSetE.F. java.utiLCollectionAnswer: B54.which two cannot directly cause a thread to stop executing?A. calling the yield methodB
溫馨提示
- 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)方式做保護(hù)處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 餐飲店租賃權(quán)及品牌使用權(quán)轉(zhuǎn)讓及加盟合同范本
- 邊疆古代手工業(yè)考古合同
- 物業(yè)管理公司車位使用權(quán)轉(zhuǎn)讓合同范本
- 安全生產(chǎn)標(biāo)準(zhǔn)化要素有哪些
- 建設(shè)工程開工前質(zhì)量安全條件核查表
- 幼兒園安全自查總結(jié)
- 安全管理績效考核細(xì)則
- 美術(shù)下雨天課件
- 安全事故案例反思總結(jié)
- 工程安全事故等級劃分
- 短期培訓(xùn)財(cái)務(wù)管理制度
- 2024-2025學(xué)年下學(xué)期高一數(shù)學(xué)人教A版期末必刷??碱}之頻率與概率
- 設(shè)備易損配件管理制度
- 口腔診所前臺主管述職報(bào)告
- 青霉素過敏反應(yīng)的急救
- 2024年廣東“三支一扶”計(jì)劃招募筆試真題
- 2025-2030中國鋁業(yè)發(fā)展?fàn)顩r與投資戰(zhàn)略研究報(bào)告
- 設(shè)備租賃方案(3篇)
- 公關(guān)費(fèi)用標(biāo)準(zhǔn)管理制度
- 2025-2030年中國潔凈室風(fēng)扇過濾單元行業(yè)市場現(xiàn)狀供需分析及投資評估規(guī)劃分析研究報(bào)告
- AI大模型賦能數(shù)字農(nóng)業(yè)農(nóng)村數(shù)字鄉(xiāng)村建設(shè)方案
評論
0/150
提交評論