java选择题_115.doc
上传人:sy****28 上传时间:2024-09-15 格式:DOC 页数:13 大小:101KB 金币:15 举报 版权申诉
预览加载中,请您耐心等待几秒...

java选择题_115.doc

java选择题_115.doc

预览

免费试读已结束,剩余 3 页请下载文档后查看

15 金币

下载此文档

如果您无法下载资料,请参考说明:

1、部分资料下载需要金币,请确保您的账户上有足够的金币

2、已购买过的文档,再次下载不重复扣费

3、资料包下载后请先用软件解压,在使用对应软件打开

单项选择115题1.WhichistheJavakeywordusedtodenoteaclassmethod?(a)class(b)static(c)private(d)final2.Thetermclassvariableisasynonymfor(a)aread-onlyvariable(b)aprivatedatafield(c)astaticdatafield(d)aninstancevariable3.WhichofthefollowingstatementsaboutclassvariablesinJavaisnottrue?(a)Non-staticmethodsinaclasscanaccesstheclassvariabledefinedinthesameclass.(b)Allobjectshavetheirowncopyoftheclassvariabledefinedintheinstantiatedclass.(c)Classvariablesrequirethemodifierstaticinthedeclarations.(d)Classvariablesdonotneedthereferencetotheobjectoftheinstantiatedclasstoaccessthem.ConsiderthefollowingUMLclassdiagram.Thediagramdescribesa(a)one-to-onerelationship(b)relationshipbetweenasubclassandasuperclass(c)self-containingclass(d)classwithoutmethods5.Whenusingnoun-phraseanalysistomodelasoftwaresystem,whichofthefollowingshouldtypicallybeeliminatedfromthelistofpotentialclasses?I.ReferencestothesoftwaresystemitselfII.NounsthatimplyrolesbetweenobjectsIII.Synonymstoothernounsinthelist(a)IandIIIonly(b)I,II,andIII(c)IIIonly(d)IIandIIIonly6.WhichofthefollowingstatementsaboutconstructorsinJavaistrue?(a)Aclassmustdefineatleastoneconstructor.(b)Aclasscandefinemorethanoneconstructor.(c)Aconstructormustbedefinedasstatic.(d)Aconstructormustbedefinedaspublic.7.Ifa(n)_____exceptioncanoccurinamethodthatdoesnothaveacatchblocktohandlethatexception,thenathrowsclausethatliststhisexceptionmustbepartofthemethod_____.(a)unchecked,body(b)checked,body(c)checked,header(d)unchecked,header8.Ifaclasscontainsaconstructor,thatconstructorwillbeinvoked(a)onceatthebeginningofanyprogramthatusesthatclass(b)eachtimeanobjectofthatclassisinstantiated(c)oncethefirsttimeanobjectofthatclassisinstantiated(d)eachtimeanobjectofthatclassgoesoutofscope9.ConsiderthefollowingJavaprogramsegment.importjava.io.*;publicclassTest{publicTest(){System.out.println("default");}publicTest(inti){System.out.println("non-default");}publicstaticvoidmain(String[]args){Testt=newTest(2);}}Whi