《JAVA试题英文版计算机Java_计算机-Java.pdf》由会员分享,可在线阅读,更多相关《JAVA试题英文版计算机Java_计算机-Java.pdf(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 children;E.
2、Cons true t i on of an i nst ance 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
3、 with new()n B.An instance 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 ass D.From with i n the package bar,an i nstance of the i nner cI ass can be construct
4、ed with new inner()n(展览、陈列):Exhibit.四 1 publ ic cI ass encI osinggone 2 public cI ass insideone)3)4 public class inertest 5 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();.wh i
5、ch stat emen t i:s true?A.An anonymous i nner c I ass may be dec Iared as final B.An anonymous i nner class can be declared as pr ivate C.An anonymous i nner class can impIement mut i pIe i nterfaces D.An anonymous i nner class can access final var iables in any scope(不能)enclosing I ns i deOne e i=I
6、 ns i deOne();五.1)interface Foo cI ass Test imp I ements Foo pub I ic static void ma i n(Stri ng args)int i;Test test What is the result?A.Comp i I ation succeeds.B.An error at I i ne 2 causes comp i I ation to fail.c.An error at I i ne 9 causes comp i I ation to fail.D.An error at I i ne 10 causes
7、comp i I ation to fail.E.An error at I i ne 11 causes comp i I ation to fail.B.defau 11 C.imp I ement D.impor t 八.wh i ch three are valid dec Iaraction of a fIoat?(float作为整数是可以的,其余几个都是double)A.float foo T;B.float foo *C.f I oat foo 42e1;D.float foo f E.float foo F.float foo 0 x0123;九.Given:8.i nt i
8、ndex=1;9.boo I ean test=new boo I ean 3;(数组作为对象缺省初始化为 fa I se)10.boolean foo=test index;2)3)1 4)pub I i c 5)6)7)=new Test();8)9)10)11)心工作以创新发展转型发展和谐发展为导向深入开展基层平安创建完善社会管理综合治理工作加强治安防控体系建设强化司法保障夯实基础着重强化对信访维稳工作的管理和处置力度推动街道综治维稳工作全面发展确保了街道社会平安为目标从源头上加大矛盾纷排查和调处力度加强对各重建地和重点地域的管控确保了今年来全局的社会稳定为街道中心工作和经济发展创造了良
9、好的社会环境现将一年来的工作总结如下年工作总结一落实综治维稳领导责任健全稳工作第一责任人职责年初根据区街签订的各项工作任务目标结合本街道实际状况街道制定了综治维稳工作计划优化了综治维稳领导机构定期分析研究部署积极破解综治信访维稳工作中的重点难点问题同时将综治信访维稳工作责任What i J the resuIt?A.foo has the va I ue of 0 B.foo has the va I ue of nu I I c.foo has the va I ue of t rue D.foo has the value of fa I s E an exception is throw
10、n F.the code wi I I not compi le+Given:1.pub I ic cI ass test(2.pub I ic static void main(Str ingargs)3.Str i ng foo=args 1;4.Str i ng foo=args;5.Str i ng foo=args 3;6.)7.1 And the command Iine invocation:Java Test Whi at i J the resuIt?A.baz has the va I ue of B.baz has the va I ue of nu I I c.baz
11、has the va I ue of“red”D.baz has the va I ue of“blue”E.bax has the va I ue of green F.the code does not com pile G.the program thi rows an except i on(此题题目出错了,重复定义了变量f。,如果没有重复的话,应选G,因为只传 递了 0-2三个数组元素,而题目中需要访问args 3,所以会抛出数组越界异 常)H int indexh;int foo=new int3:int bar=fooindex;baz has a value of 0 B.ba
12、z has vaIue of 1 C.baz has vaIue of 2 D.an exception is thrown E.the code wi I I not compi Ie 十二.1)pub Iic class Foo 2)pub I ic static void ma i n(Stri ng args)心工作以创新发展转型发展和谐发展为导向深入开展基层平安创建完善社会管理综合治理工作加强治安防控体系建设强化司法保障夯实基础着重强化对信访维稳工作的管理和处置力度推动街道综治维稳工作全面发展确保了街道社会平安为目标从源头上加大矛盾纷排查和调处力度加强对各重建地和重点地域的管控确保了
13、今年来全局的社会稳定为街道中心工作和经济发展创造了良好的社会环境现将一年来的工作总结如下年工作总结一落实综治维稳领导责任健全稳工作第一责任人职责年初根据区街签订的各项工作任务目标结合本街道实际状况街道制定了综治维稳工作计划优化了综治维稳领导机构定期分析研究部署积极破解综治信访维稳工作中的重点难点问题同时将综治信访维稳工作责任3)Str ing s;心工作以创新发展转型发展和谐发展为导向深入开展基层平安创建完善社会管理综合治理工作加强治安防控体系建设强化司法保障夯实基础着重强化对信访维稳工作的管理和处置力度推动街道综治维稳工作全面发展确保了街道社会平安为目标从源头上加大矛盾纷排查和调处力度加强对
14、各重建地和重点地域的管控确保了今年来全局的社会稳定为街道中心工作和经济发展创造了良好的社会环境现将一年来的工作总结如下年工作总结一落实综治维稳领导责任健全稳工作第一责任人职责年初根据区街签订的各项工作任务目标结合本街道实际状况街道制定了综治维稳工作计划优化了综治维稳领导机构定期分析研究部署积极破解综治信访维稳工作中的重点难点问题同时将综治信访维稳工作责任4)s=+s);5)6)十三.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 do
15、uble methoda():B.static void methoda(double 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 ac
16、compI i sh thi s objective?(你希望子类在任何包里都能访问父类,为完成这个目的,下列哪个是最严格的 访问权限)A.Pub I i c B.Private C.Protected D.Trans i ent E.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.
17、pr i va te floa t get Floa t()re turn f 1;)7.What is the result?A.Comp i I ation i s successful B.An error on I ine 6 causes a runtime fai Iure(抛岀实时异常)C An error at line 6 causes comp i I ation to fai I.D.An error at line 2 causes comp i I ation to fai I.what is the resuIt?A.B.c.D.The The The The co
18、de code code code compiIes comp i Ies does not does not s二”i s pr i nted.Us=nulIn is printed.E The code comp i I es,i s ca I I ed.and and compi Ie because 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 心工作以创新发展转型
19、发展和谐发展为导向深入开展基层平安创建完善社会管理综合治理工作加强治安防控体系建设强化司法保障夯实基础着重强化对信访维稳工作的管理和处置力度推动街道综治维稳工作全面发展确保了街道社会平安为目标从源头上加大矛盾纷排查和调处力度加强对各重建地和重点地域的管控确保了今年来全局的社会稳定为街道中心工作和经济发展创造了良好的社会环境现将一年来的工作总结如下年工作总结一落实综治维稳领导责任健全稳工作第一责任人职责年初根据区街签订的各项工作任务目标结合本街道实际状况街道制定了综治维稳工作计划优化了综治维稳领导机构定期分析研究部署积极破解综治信访维稳工作中的重点难点问题同时将综治信访维稳工作责任(子类覆盖父类
20、方法的时候,不能比父类方法具有更严格的访问权限)A.Comp i I at i on will fail.B.Compi lation wi I I succeed and the program wi I I pr int 0”C Comp i I ation wi I I succeed and the program wi I I pr i nt 1”D.Compi I at ion wi I I succeed and the program wi I I pr i nt u2n 十七 1)class Super 2)pub I ic float getNumO return;3)4)
21、5)pub I ic cI ass Sub extends Super 6)6)wh i ch method,pIaced at line 6,wi I I cause a comp i I er error?A.pub I ic f loat getNum()return;)B.pub I ic void getNumO)返回值类型不同不足以构成方法的重载 C.publ ic void getNum(double d)D.publ ic double getNum(float d)return;十八 Which dec I ara tion preven ts creat i ng a su
22、bc I ass of an outer c I ass?c I ass FooBar)c I ass Foobar)c I ass FooBar)pub I i c c I ass FooBar)abstrac t c I ass FooBar)抽象类不能声明为 final 1.pub I ic cI ass test 2.pub I i c i nt aMethod()3.static int i二0;4.i+;5.return I;6.)7.pub I i c static vo i d ma i n 8.test test=new test();9.0;10.i nt j 二();11
23、.12.)13.)十六.Click the exhibit button:(String args)(局部变量不能声明为静态)What i s the resu11?心工作以创新发展转型发展和谐发展为导向深入开展基层平安创建完善社会管理综合治理工作加强治安防控体系建设强化司法保障夯实基础着重强化对信访维稳工作的管理和处置力度推动街道综治维稳工作全面发展确保了街道社会平安为目标从源头上加大矛盾纷排查和调处力度加强对各重建地和重点地域的管控确保了今年来全局的社会稳定为街道中心工作和经济发展创造了良好的社会环境现将一年来的工作总结如下年工作总结一落实综治维稳领导责任健全稳工作第一责任人职责年初根据区
24、街签订的各项工作任务目标结合本街道实际状况街道制定了综治维稳工作计划优化了综治维稳领导机构定期分析研究部署积极破解综治信访维稳工作中的重点难点问题同时将综治信访维稳工作责任十九.byte arrayl.array2 byte array3 byte array4 i f each has bee n initial ized.wh i ch stat emen t wi I I cause a comp i I e error?A.array2=ar rayl;B.array2=array3:C array2=array4;D.both A and B E.both A and C F.bot
25、h B and C(一维数组和二维数组的区别)二十.cI ass Super pub I ic irrt i 二0;pub Iic Super(Stri ng text)i=1;)pub I i c cI ass Sub extends Super pub I ic Sub(Stri ng text)i=2;pub I ic static void ma i n(Stri ng args)Sub sub二new Sub(He I Io);)what:i s the resuIt?A.compi le wi I I fai I B.comp i Ie success and pr i nt p
26、i Ie success and pr i nt D.comp i Ie success and pr i nt 子类总要去调用父类的构造函数,有两种调用方式,自动调用(无参构造函数),主动调用带参构造函数。.心工作以创新发展转型发展和谐发展为导向深入开展基层平安创建完善社会管理综合治理工作加强治安防控体系建设强化司法保障夯实基础着重强化对信访维稳工作的管理和处置力度推动街道综治维稳工作全面发展确保了街道社会平安为目标从源头上加大矛盾纷排查和调处力度加强对各重建地和重点地域的管控确保了今年来全局的社会稳定为街道中心工作和经济发展创造了良好的社会环境现将一年来的工作总结如下年工作总结一落实综治维稳领导责任健全稳工作第一责任人职责年初根据区街签订的各项工作任务目标结合本街道实际状况街道制定了综治维稳工作计划优化了综治维稳领导机构定期分析研究部署积极破解综治信访维稳工作中的重点难点问题同时将综治信访维稳工作责任