




下載本文檔
版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進行舉報或認領(lǐng)
文檔簡介
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
2、Animalprivate Species species;E. interface Component Class Container implements Component ( Private Component children;二which statement is true A. An anonymous inner class may be declared as final B. An anonymous inner class can be declared as private
3、C. An anonymous inner class can implement mutiple interfaces D. An anonymous inner class can access final variables in any enclosing scope (不能)E. Construction of an instance of a static inner class requires an instance of the encloing outer class 構(gòu)造一個靜態(tài)的內(nèi)部類對象需要構(gòu)造包含它的外部類的對象三. Given:1. package foo;2.&
4、#160; 3. public class Outer (4. public static class Inner (5. )6. )Which statement is true? A. An instance of the Inner class can be constructed with “new Outer.Inner ()”B. An instance of the inner class cannot be constructed outside of package foo他們都是public的,只要在外
5、部import就行C. 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()”四Exhibit(展覽、陳列):1 public class enclosinggone2 public class insideone3 4 public class inertest5 public stat
6、ic void main (String args)6 enclosingone eo = new enclosingone();7 /insert code here8 Which statement at line 7 constructs an instance of the inner class?A. InsideOne ei = eo.new InsideOne(); 寫程序試出來B. Eo.InsideOne ei = eo.new InsideOne();C InsideOne ei = EnclosingOne.new InsideOne();D.EnclosingOne I
7、nsideOne ei = eo.new InsideOne();五 1) interface Foo 2) int k=0; 3) 4) public class Test implements Foo 5)
8、0; public static void main(String args) 6) int i; 7)
9、0; Test test =new Test(); 8) i=test.k; 9)
10、; i=Test.k; 10)
11、160; i=Foo.k; 11) 12) What is the result? A. Compilation succeeds.B. An error at line 2 causes compilation to fail.C.
12、An error at line 9 causes compilation to fail.D. An error at line 10 causes compilation to fail.E. An error at line 11 causes compilation to fail.六 /point X public class Foo public static void main(String args) PrintWriter out=new PrintWriter(new java.io.OutputStreamWriter(System.out),true); out.pri
13、ntln("Hello"); which statement at point X on line 1 allows this code to compile and run 在point X這個位置要填入什么代碼才能使程序運行A.import java.io.PrintWriter B.include java.io.PrintWriter C.import java.io.OutputStreamWriter D.inclu
14、de java.io.OutputStreamWriter E.No statement is needed 本來兩個都要import,但是后者OutputStreamWriter指定了包結(jié)構(gòu)java.io.OutputStreamWriter七 what is reserved words in java 保留字而非關(guān)鍵字A. run B. default C. implement D. import 八. which three are valid declaraction of a float (float作為整數(shù)是可以的,其余幾個都是double) A. float foo=
15、-1; B. float foo=1.0; C. float foo=42e1; D. float foo=2.02f; E. float foo=3.03d; F. float foo=0x0123; 九. Given:8. int index = 1;9. boolean test = new boolean3; (數(shù)組作為對象缺省初始化為false)10. boolean foo= test index; What is the result? A. foo
16、has the value of 0B. foo has the value of nullC. foo has the value of trueD. foo has the value of falseE. an exception is thrownF. the code will not compile十. Given:1. public class test(2. public static void main(Stringargs)3. String foo = args 1;4. String foo = args 2;5. String foo = args 3;6. 7. A
17、nd the command line invocation:Java Test What is the result? A. baz has the value of “”B. baz has the value of nullC. baz has the value of “red”D. baz has the value of “blue”E. bax has the value of “green”F. the code does not compileG. the program throws an exception(此題題目出錯了,重復定義了變量foo,如果沒有重復的話,應選G,
18、因為只傳遞了0-2三個數(shù)組元素,而題目中需要訪問args 3,所以會拋出數(shù)組越界異常)十一. int index=1; int foo=new int3; int bar=fooindex; /bar=0int baz=bar+index; /baz=1what is the result A. baz has a value of 0 B. baz has value of 1 C. baz has value of 2 D. an exception is thrown E. the code will not compile 十二. 1)public class Foo 2) publi
19、c static void main(String args) 3) String s; 4) System.out.println("s="+s); 5) 6) what is the result A. The code compiles and “s=” is printed.B. The code compiles and “s=null” is printed.C. The code does not compile because string s is not initialized. D. The code does not comp
20、ile because string s cannot be referenced.E. The code compiles, but a NullPointerException is thrown when toString is called.十三. Which will declare a method that forces a subclass to implement it? (誰聲明了一個方法,子類必須實現(xiàn)它)A. public double methoda();B. static void methoda (double d1) C. public native double
21、 methoda();D. abstract public void methoda();E. protected void methoda (double d1)十四. You want subclasses in any package to have access to members of a superclass. Which is the most restrictive access modifier that will accomplish this objective?(你希望子類在任何包里都能訪問父類,為完成這個目的,下列哪個是最嚴格的訪問權(quán)限)A. PublicB. Pr
22、ivateC. ProtectedD. TransientE. No access modifier is qualified十五. Given:1. abstract class abstrctIt 2. abstract float getFloat ();3. )4. public class AbstractTest extends AbstractIt 5. private float f1= 1.0f;6. private float getFloat () return f1;7. What is the result?A. Compilation is successful.B
23、. An error on line 6 causes a runtime failure.(拋出實時異常)C. An error at line 6 causes compilation to fail.D. An error at line 2 causes compilation to fail.(子類覆蓋父類方法的時候,不能比父類方法具有更嚴格的訪問權(quán)限)十六. Click the exhibit button:1. public class test2. public int aMethod()3. static int i=0; 4.
24、;i+; 5. return I; 6. 7. public static void main (String args) 8. test test = new test(); 9. test.aMethod(); 10. int j = test.aMethod(); 11. System.out.printIn(j); 12. 13. (局部變量不能聲明為靜態(tài)) What is the result? A. Compilation will fail.B. Compila
25、tion will succeed and the program will print “0”.C. Compilation will succeed and the program will print “1”.D. Compilation will succeed and the program will print “2”.十七.1) class Super 2) public float getNum()return 3.0f; 3) 4) 5) public class Sub extends Super 6) 7) wh
26、ich method, placed at line 6, will cause a compiler error A. public float getNum()return 4.0f; B. public void getNum() 返回值類型不同不足以構(gòu)成方法的重載C. public void getNum(double d) D. public double getNum(float d)return 4.0d; 十八. Which declaration prevents creating a subclass of an outer class A.static class FooBar B.pivate class Foobar C.abstract class FooBar D.final public class FooBar E.final abstract class FooBar 抽象類不能聲明為final十九. byte array1,array2 byte array3 byte ar
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負責。
- 6. 下載文件中如有侵權(quán)或不適當內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 2025黃山市徽州國有投資集團有限公司招聘12人筆試參考題庫附帶答案詳解
- 河南xx化工園區(qū)建設項目實施方案
- 工廠建設項目實施前期研究
- 2025年工程經(jīng)濟高效管理試題及答案
- 2025年海洋風電場運維服務與市場前景分析報告
- 2025年建筑工程考試復習手冊試題及答案
- 行政管理與市政學相互關(guān)系試題及答案
- 2025年市政學考試的前期準備試題及答案
- 2025年K2教育STEM課程實施效果評估與改進策略深度報告
- 2024年水利水電工程考生經(jīng)驗分享與試題及答案
- 2025年重慶中考語文a試題及答案2024
- 大學生的人際交往困境與突破
- 第八單元常見的酸、堿、鹽基礎練習題-+2024-2025學年九年級化學科粵版(2024)下冊
- 2024國家安全教育大學生讀本題庫
- 黃河文化(齊魯工業(yè)大學)知到智慧樹章節(jié)測試課后答案2024年秋齊魯工業(yè)大學
- 變電站電網(wǎng)側(cè)儲能項目可行性研究報告
- 第十二周《遇見勞動之美點亮成長底色》主題班會
- 世界環(huán)境日環(huán)保教育班會 課件
- 臨床診療指南-疼痛學分冊
- 舊房改造施工設計方案
- 2024年山東職業(yè)學院高職單招語文歷年參考題庫含答案解析
評論
0/150
提交評論