欢迎来到天天文库
浏览记录
ID:40559490
大小:101.50 KB
页数:13页
时间:2019-08-04
《java选择题_115》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、单项选择115题1.WhichistheJavakeywordusedtodenoteaclassmethod?(a)class(b)static(c)private(d)final2.Thetermclassvariableisasynonymfor(a)aread-onlyvariable(b)aprivatedatafield(c)astaticdatafield(d)aninstancevariable3.WhichofthefollowingstatementsaboutclassvariablesinJavais
2、nottrue?(a)Non-staticmethodsinaclasscanaccesstheclassvariabledefinedinthesameclass.(b)Allobjectshavetheirowncopyoftheclassvariabledefinedintheinstantiatedclass.(c)Classvariablesrequirethemodifierstaticinthedeclarations.(d)Classvariablesdonotneedthereferencetotheobj
3、ectoftheinstantiatedclasstoaccessthem.4.ConsiderthefollowingUMLclassdiagram.Thediagramdescribesa(a)one-to-onerelationship(b)relationshipbetweenasubclassandasuperclass(c)self-containingclass(d)classwithoutmethods5.Whenusingnoun-phraseanalysistomodelasoftwaresystem,w
4、hichofthefollowingshouldtypicallybeeliminatedfromthelistofpotentialclasses?I.ReferencestothesoftwaresystemitselfII.NounsthatimplyrolesbetweenobjectsIII.Synonymstoothernounsinthelist(a)IandIIIonly(b)I,II,andIII(c)IIIonly(d)IIandIIIonly6.Whichofthefollowingstatements
5、aboutconstructorsinJavaistrue?(a)Aclassmustdefineatleastoneconstructor.(b)Aclasscandefinemorethanoneconstructor.(c)Aconstructormustbedefinedasstatic.(d)Aconstructormustbedefinedaspublic.7.Ifa(n)_____exceptioncanoccurinamethodthatdoesnothaveacatchblocktohandlethatex
6、ception,thenathrowsclausethatliststhisexceptionmustbepartofthemethod_____.(a)unchecked,body(b)checked,body(c)checked,header(d)unchecked,header8.Ifaclasscontainsaconstructor,thatconstructorwillbeinvoked(a)onceatthebeginningofanyprogramthatusesthatclass(b)eachtimeano
7、bjectofthatclassisinstantiated(c)oncethefirsttimeanobjectofthatclassisinstantiated(d)eachtimeanobjectofthatclassgoesoutofscope9.ConsiderthefollowingJavaprogramsegment.importjava.io.*;publicclassTest{publicTest(){System.out.println("default");}publicTest(inti){Syste
8、m.out.println("non-default");}publicstaticvoidmain(String[]args){Testt=newTest(2);}}Whichofthefollowingwillbeoutputduringexecutionoftheprogramseg
此文档下载收益归作者所有