Andy老师 发表于 2020-5-6 09:00:24

电子科技大学20春《JAVA程序设计》在线作业2

(单选题)1:若在某一个类定义中定义有方法:abstractvoidf();则该类是
A:public类
电子科技大学
奥鹏在线作业联系QQ515224986
B:final类
C:抽象类
D:不能确定
正确答案:
(单选题)2:Aclassdesignrequiresthatamembervariableshouldbeaccessibleonlybysamepackage,whichmodiferwordshouldbeused?
A:protected
B:public
C:nomodifer
D:private
正确答案:    奥鹏作业咨询QQ515224986
(单选题)3:在Java语言中,包是自动导入的。
A:java.lang
B:java.awt
C:java.applet
D:java.io
正确答案:
(单选题)4:Java语言中,是所有类的根类。
A:Object
B:Root
C:Thread
D:Applet
正确答案:
(单选题)5:关键字super的作用是
A:用来访问父类被隐藏的成员变量
B:用来调用父类中被重载的方法
C:用来调用父类的构造方法
D:以上都是
正确答案:
(单选题)6:构造方法在时候被调用。
A:类定义时
B:创建对象时
C:调用对象方法时
D:使用对象的变量时
正确答案:
(单选题)7:下列叙述中不正确的是
A:abstract不能与final并列修饰同一个类
B:abstract类中不可以有private的成员
C:abstract方法必须在abstract类中
D:static方法中能直接处理非static的属性
正确答案:
(单选题)8:Java源文件中最多只能有一个类,其他类的个数不限。
A:abstract
B:public
C:final
D:interface
正确答案:
(单选题)9:实现下列接口可以对TextField对象的事件进行监听和处理。
A:ActionListener
B:FocusListener
C:MouseMotionListener
D:WindowListener
正确答案:
(单选题)10:以下方法用于定义线程的执行体(线程体)。
A:start()
B:init()
C:run()
D:synchronized()
正确答案:
(单选题)11:JavaApplication源程序文件的扩展名为
A:.java
B:.class
C:vu80
D:.exe
正确答案:
(单选题)12:Java语言是在语言基础上衍生的。
A:pascal
B:C
C:C++
D:VF
正确答案:
(单选题)13:下面函数是publicvoidexample(intk){...}的重载函数。
A:publicvoidexample(intm){...}
B:publicintexample(intk){...}
C:publicvoidexample2(intk){...}
D:publicintexample(intm,floatf){...}
正确答案:
(单选题)14:监听器接口的方法返回值是
A:int
B:String
C:void
D:Object
正确答案:
(单选题)15:Thread类的方法中,toString()方法的作用是
A:只返回线程的名称
B:返回当前线程所属的线程组的名称
C:返回当前线程对象
D:返回线程的字符串信息
正确答案:
(单选题)16:下面是类A的构造函数声明,其中正确的是
A:voidA(intx){...}
B:A(intx){...}
C:a(intx){...}
D:voida(intx){...}
正确答案:
(单选题)17:Whichmodifiershouldbeappliedtoamethodforthelockofobject"this"tobeobtainedpriortoexcutionanyofthemethodbody?
A:synchronized
B:abstract
C:final
D:static
正确答案:
(单选题)18:classA
{publicintgetNumber(inta){returna+1;}}
classBextendsA
{publicintgetNumber(inta,charc){returna+2;}
publicstaticvoidmain(String[]args)
{Bb=newB();System.out.println(b.getNumber(0));}
}
whatistheresult?
A:compilationsucceedsand1isprinted
B:compilationsucceedsand2isprinted
C:compilationsucceedsand3isprinted
D:Anerroratthisprogramcausecompilationtofail
正确答案:
(单选题)19:publicclassTest{
publicstaticvoidmain(String[]args){
Stringa=args;Stringb=args;Stringc=args;
}
}
executecommand:javaTestRedGreenBlue
whatisthevalueofc?
A:chasvalueofnull
B:chasvalueofBlue
C:thecodedoesnotcompile
D:theprogramthrowanexception
正确答案:
(单选题)20:如下方法可以将MenuBar加入Frame中。
A:setMenu()
B:setMenuBar()
C:add()
D:addMenuBar()
正确答案:
(判断题)21:()字符串分为两大类,一类是字符串常量,使用StringBuffer类的对象表示;另一类是字符串变量,使用String类的对象表示。
A:错误
B:正确
正确答案:
(判断题)22:()子类要调用父类的方法,必须使用super关键字。
A:错误
B:正确
正确答案:
(判断题)23:()如果p是父类Parent的对象,而c是子类Child的对象,则语句c=p是正确的。
A:错误
B:正确
正确答案:
(判断题)24:()用“+”可以实现字符串的拼接,用“-”可以从一个字符串中去除一个字符子串。
A:错误
B:正确
正确答案:
(判断题)25:()Asubclassinheritsallmethods(includingtheconstructor)fromthesuperclass.
A:错误
B:正确
正确答案:

电子科技大学
奥鹏作业
页: [1]
查看完整版本: 电子科技大学20春《JAVA程序设计》在线作业2