JAVA试题英文版

上传人:汽*** 文档编号:485396353 上传时间:2023-11-21 格式:DOC 页数:7 大小:138.50KB
返回 下载 相关 举报
JAVA试题英文版_第1页
第1页 / 共7页
JAVA试题英文版_第2页
第2页 / 共7页
JAVA试题英文版_第3页
第3页 / 共7页
JAVA试题英文版_第4页
第4页 / 共7页
JAVA试题英文版_第5页
第5页 / 共7页
点击查看更多>>
资源描述

《JAVA试题英文版》由会员分享,可在线阅读,更多相关《JAVA试题英文版(7页珍藏版)》请在金锄头文库上搜索。

1、 Wh i ch two demonstrate an is a” re I ationship? (Choose Two)A. pub Iic interface Person )pub Iic interface Shape )pub Iic interface Color Jpubl ic cI ass Species pub Iic class Animalpr ivate Species species;)E. interface Component CI ass Container imp I ements Component (Pr i vate Component childr

2、en;.wh i ch stat emen t i:s true?A.Ananonymousi nnerc I assmaybe dec Iaredas finalB.Ananonymousi nnerclasscanbe declaredas pr ivateC.Ananonymousi nnerclasscanimpIement mut i pIe i nterfacesD.Ananonymousi nnerclasscan access finalvar iables in anyscope(不能)enclosingE. Cons true t i on of an i nst ance

3、 of a stat i c i nner c I ass requ i res an i nst ance of the encIoing outer cI ass 构造一个静态的内部类对象需要构造包含它的外部类的对象三.G i ven:package foo;2.3. public class Outer (4. publ ic static class Inner (5. )6. )Which statement is true?A. An instance of the Inner cI ass can be construeted with new ()nB. An instance

4、 of the i nner c I ass cannot be cons true ted out s i de of package foo他们都是publ ic的,只要在外部import就行C An instance of the inner c I ass can only be cons trucked from wit h i n the outer cI assD. From with i n the package bar, an i nstance of the i nner cI ass can be constructed with new inner ()n(展览、陈列

5、):Exhibit.四1 publ ic cI ass encI osinggone 2 public cI ass insideone)3 )4 public class inertest5 public static void main (Str ing args) 6 encI os i ngone eo = new encI os i ngone ();7 I ns i deOne e i = I ns i deOne 0 ;写程序试出来B. e i = I ns i deOne ():C InsideOne e i = InsideOne();I ns i deOne e i = I

6、 ns i deOne ();五.2)3) 14) pub I i c5)6)7)=new Test ();8)9)10)11)12)1) interface Foo cI ass Test imp I ements Foo pub I ic static void ma i n (Stri ng args) int i ;Test testWhat is the result?A. Comp i I ation succeeds.B.AnerroratI i ne2causescomp i I ationto fail.c.AnerroratI i ne9causescomp i I ati

7、onto fail.D.AnerroratI i ne10causescomp i I ationto fail.E.AnerroratI i ne11causescomp i I ationto fail.B. defau 11C. imp I ementD. impor t八. wh i ch three are valid dec Iaraction of a fIoat?(float作为整数是可以的,其余几个都是double)A. float fooT;B. float foo*C. f I oat foo42e1;D. float foofE. float fooF. float f

8、oo0x0123;九.Given:8. i nt i ndex = 1 ;9. boo I ean test = new boo I ean 3;(数组作为对象缺省初始化为 fa I se)10. boolean foo= test index;What i j the resuIt?A.foohastheva I ueof0B.foohastheva I ueofnu I Ic.foohastheva I ueoft rueD.foohasthevalueoffa I sE an exception is thrownF. the code wi I I not compi le+Given

9、:1.pub I iccI ass test(2.pub I icstatic voidmain(Str ingargs) 3.Str i ngfoo = args1;4.Str i ngfoo = args;5.Str i ng foo = args3;6.)7. 1And the command Iine invocation:Java TestWhiat i j the resuIt?A.bazhasthevaI ueofB.bazhasthevaI ueofnu I Ic.bazhasthevaI ueof“red”D.bazhasthevaI ueof“blue”E.baxhasth

10、evaI ueofgreenF.thecode does notcompileG.theprogramthirows anexcept i on(此题题目出错了,重复定义了变量f。,如果没有重复的话,应选G,因为只传 递了 0-2三个数组元素,而题目中需要访问args 3,所以会抛出数组越界异 常)Hint indexh;int foo=new int3:int bar=fooindex; baz has a value of 0B. baz has vaIue of 1C. baz has vaIue of 2D. an exception is thrownE. the code wi I

11、 I not compi Ie十二.1) pub Iic class Foo 2) pub I ic static void ma i n (Stri ng args) 3) Str ing s;4) s=+s);5) 6) what is the resuIt?A.B.c.D.TheTheTheThecode code code codecompiIes comp i Ies does not does nots二” i s pr i nted. Us=nulIn is printed.E The code comp i I es,i s ca I I ed.andandcompi Ie b

12、ecause str ing s is not initialized compi Ie because string s cannot be referenced but a Nu I I Po int erExcep tion is t hr own when toString十三.Wh i ch wi I I dec I are a met hod that forces a subc I ass to impleme nt it? (谁声明了一个方法,子类必须实现它)A. publ ic double methoda ():B. static void methoda (double

13、d1) )C publ ic nat ive doubIe methoda ():D. abstract pub I ic void methoda ();E. protected void methoda (doubIe d1) )十四You want subcI asses i n any package to have access to members of a supercI ass Which i s the most restrietive access mod i f i er that wi I I accompI i sh thi s objective?(你希望子类在任何

14、包里都能访问父类,为完成这个目的,下列哪个是最严格的 访问权限)A. Pub I i cB. PrivateC. ProtectedD. Trans i entE. No access mod i f i er i s qua I i f i ed十五.Given:abstract cI ass abstret It 2. abstract float getFloat 0;3. )4. publ ic cI ass AbstractTest extends Abstractit 5. pr i vate fIoat f1二;6. pr i va te floa t get Floa t () re turn f 1 ;)7. What is the result?A. Comp i I ati

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 建筑/环境 > 施工组织

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号