java200道选择题已做

java200道选择题已做

ID:37923364

大小:164.00 KB

页数:38页

时间:2019-06-02

java200道选择题已做_第1页
java200道选择题已做_第2页
java200道选择题已做_第3页
java200道选择题已做_第4页
java200道选择题已做_第5页
资源描述:

《java200道选择题已做》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库

1、一.选择题(234)1.下面中哪两个可以在A的子类中使用:(A,C)classA{protectedintmethod1(inta,intb){return0;}}A.publicintmethod1(inta,intb){return0;}B.privateintmethod1(inta,intb){return0;}C.privateintmethod1(inta,longb){return0;}D.publicshortmethod1(inta,intb){return0;}2.Abstractmethodcannotbestatic.TrueorFalse?(

2、A)A.TrueB.False3.Whatwillbetheoutputwhenyoucompileandexecutethefollowingprogram.classBase{voidtest(){System.out.println("Base.test()");}}publicclassChildextendsBase{voidtest(){System.out.println("Child.test()");}staticpublicvoidmain(String[]a){ChildanObj=newChild();BasebaseObj=(Base)anO

3、bj;baseObj.test();}}Selectmostappropriateanswer.AA.Child.test()Base.test()B.Base.test()Child.test()C.Base.test()D.Child.test()4.Whatwillbetheoutputwhenyoucompileandexecutethefollowingprogram.classBase{staticvoidtest(){System.out.println("Base.test()");}}publicclassChildextendsBase{voidt

4、est(){System.out.println("Child.test()");Base.test();//Calltheparentmethod}staticpublicvoidmain(String[]a){newChild().test();}}Selectmostappropriateanswer.CA.Child.test()Base.test()B.Child.test()Child.test()C.Compilationerror.CannotoverrideastaticmethodbyaninstancemethodD.Runtimeerror.C

5、annotoverrideastaticmethodbyaninstancemethod5.Whatwillbetheoutputwhenyoucompileandexecutethefollowingprogram.publicclassBase{privatevoidtest(){System.out.println(6+6+"(Result)");}staticpublicvoidmain(String[]a){newBase().test();}}Selectmostappropriateanswer.BA.66(Result)B.12(Result)C.Ru

6、ntimeError.Incompatibletypefor+.Can'tconvertaninttoastring.D.CompilationError.Incompatibletypefor+.Can'taddastringtoanint.6..Whatwillbetheoutputwhenyoucompileandexecutethefollowingprogram.Thesymbol’.’meansspace.publicclassBase{privatevoidtest(){StringaStr=".One.";StringbStr=aStr;aStr.to

7、UpperCase();aStr.trim();System.out.println("["+aStr+","+bStr+"]");}staticpublicvoidmain(String[]a){newBase().test();}}Selectmostappropriateanswer.EA.[ONE,.One.]B.[.One.,One]C.[ONE,One]D.[ONE,ONE]E.[.One.,.One.]7.下面关于变量及其范围的陈述哪些是不正确的(B):A.实例变量是类的成员变量)B.实例变量用关键字static声明(用static修饰

当前文档最多预览五页,下载文档查看全文

此文档下载收益归作者所有

当前文档最多预览五页,下载文档查看全文
温馨提示:
1. 部分包含数学公式或PPT动画的文件,查看预览时可能会显示错乱或异常,文件下载后无此问题,请放心下载。
2. 本文档由用户上传,版权归属用户,天天文库负责整理代发布。如果您对本文档版权有争议请及时联系客服。
3. 下载前请仔细阅读文档内容,确认文档内容符合您的需求后进行下载,若出现内容与标题不符可向本站投诉处理。
4. 下载文档时可能由于网络波动等原因无法下载或下载错误,付费完成后未能成功下载的用户请联系客服处理。