欢迎来到天天文库
浏览记录
ID:38353215
大小:154.00 KB
页数:20页
时间:2019-06-11
《英文北京东方国信JAVA面试》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、PartⅠ(每题1分)1)Whichofthefollowinglineswillcompilewithoutwarningorerror?Selectallvalidanswers.aea)floatf=0;b)charc="0";c)byteb=157;d)booleanf=null;e)inti=10;2)Whatarethevalidtypesforthegivenvariablei?cpublicclassBase{privatevoidtest(){//i=1;switch(i){}}st
2、aticpublicvoidmain(String[]a){newBase().test();}}Selectmostappropriateanswer.a)char,intb)boolean,byte,char,short,intc)byte,char,short,intd)byte,char,short,int,longe)Onlyint3)Whatisthecorrectwayofdeclaratingmain()sothattheprogarmcanbecompiledandexecutedu
3、singthisentrypoint.abcfa)staticpublicvoidmain(String[]args)b)staticpublicvoidmain(Stringa[])c)publicstaticvoidmain(String[]a)d)staticvoidpublicmain(String[]a)e)publicvoidmain(String[]a)f)staticpublicvoidmain(chararg[][])201)Whatwillbeoutputiftheprogrami
4、sexecutedasbelowjava-DOne-DTwo-DThreeSamplepublicclassSample{publicstaticvoidmain(Stringargv[]){System.out.println(argv[2])}}Selectmostappropriateanswer.ba)Oneb)Twoc)Threed)Exceptionraised:"java.lang.ArrayIndexOutOfBoundsException:2"e)NonePartⅡ(每题1分)2)A
5、bstractmethodcannotbestatic.TrueorFalse?truea)Trueb)False3)Whatwillbetheoutputwhenyoucompileandexecutethefollowingprogram.d////////////////////////////////////////////classBase{voidtest(){System.out.println("Base.test()");}}/////////////////////////////
6、///////////////publicclassChildextendsBase{voidtest(){System.out.println("Child.test()");}staticpublicvoidmain(String[]a){ChildanObj=newChild();BasebaseObj=(Base)anObj;20//Baseb=newChild();//b.test();baseObj.test();}}Selectmostappropriateanswer.a)Child.
7、test()Base.test()b)Base.test()Child.test()c)Base.test()d)Child.test()1)Whatwillbetheoutputwhenyoucompileandexecutethefollowingprogram.C////////////////////////////////////////////classBase{staticvoidtest(){System.out.println("Base.test()");}}///////////
8、/////////////////////////////////publicclassChildextendsBase{voidtest(){System.out.println("Child.test()");Base.test();//Calltheparentmethod}staticpublicvoidmain(String[]a){newChild().test();}}Selectmostappropriateanswer.a)Child.
此文档下载收益归作者所有