电子科大18春《JAVA程序设计》在线作业3

  • 格式:doc
  • 大小:44.00 KB
  • 文档页数:6

下载文档原格式

  / 6
  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

(单选题) 1: 实现下列接口可以对TextField对象的事件进行监听和处理。

A: ActionListener

B: FocusListener

C: MouseMotionListener

D: WindowListener

(单选题) 2: 下列是Java的调试器,如果编译器返回程序代码的错误,可以用它对程序进行调试。

A: java.exe

B: javadoc.exe

C: jdb.exe

D: javaprof.exe

(单选题) 3: 容器Panel和Applet默认使用的布局管理器是

A: CardLayout

B: BorderLayout

C: FlowLayout

D: GridLayout

(单选题) 4: 下列语句输出结果为。public class A{public static void main(String[]args){byte b=0xa;System.out.println(b);}}

A: 0xa

B: a

C: 1

D: 10

(单选题) 5: Give the following java class: public class Example {public static void main(String args[]) {int x[] = new int[15];System.out.println(x[5]);} } Which statement is corrected?

A: When compile, some error will occur.

B: When run, some error will occur.

C: Output is zero.

D: Output is null.

(单选题) 6: Which modifer should be applied to a declaration of a class member variable for the value of variable to remain constant after the creation of the object? A: static

B: final

C: const

D: abstract

(单选题) 7: 下列不是Java的保留字。

A: do

B: double

C: sizeof

D: while

(单选题) 8: 类是所有异常类的父类。

A: Throwable

B: Error

C: Exception

D: AWTError

(单选题) 9: 若在某一个类定义中定义有方法:abstract void f();则该类是

A: public类

B: final类

C: 抽象类

D: 不能确定

(单选题) 10: A class design requires that a member variable should be accessible only by same package, which modifer word should be used?

A: protected

B: public

C: no modifer

D: private

(单选题) 11: public class X extends Frame{ public static void main(String[] args){ X x=new X();x.pack();x.setVisible(true); } public X(){ setLayout(new GridLayout(2,2)); Panel p1=new Panel(); add(p1); Button b1

A: all change height and width

B: Button One change height

C: Button Two change height and Button Three change width

D: Button Four change height and width

(单选题) 12: Thread类的方法中,toString()方法的作用是

A: 只返回线程的名称

B: 返回当前线程所属的线程组的名称

C: 返回当前线程对象

D: 返回线程的字符串信息

(单选题) 13: 构造方法在时候被调用。

A: 类定义时

B: 创建对象时

C: 调用对象方法时

D: 使用对象的变量时

(单选题) 14: 如下方法可以将MenuBar加入Frame中。

A: setMenu()

B: setMenuBar()

C: add()

D: addMenuBar()

(单选题) 15: 下列常见的系统定义的异常中,是数组下标越界异常。A: ArithmeticException

B: IOException

C: ArrayIndexOutOfBoundsException

D: NullPointerException

(单选题) 16: 下列关于接口的叙述中,是正确的。

A: 接口与抽象类是相同的概念

B: 接口之间不能有继承关系

C: 一个类只能实现一个接口

D: 接口中只含有抽象方法和常量

(单选题) 17: 下列叙述中,是正确的。

A: 类是变量和方法的集合体

B: 数组是无序数据的集合

C: 抽象类可以实例化

D: 类成员数据必须是公有的

(单选题) 18: 在Java中,用关键字定义常量。

A: define

B: fixed

C: const

D: final