云题海 - 专业文章范例文档资料分享平台

当前位置:首页 > JAVA语言程序设计期末考试试题和答案

JAVA语言程序设计期末考试试题和答案

  • 62 次阅读
  • 3 次下载
  • 2025/5/4 20:46:21

.

15、在复选框中移动鼠标,然后单击一选项,要捕获所选项必需实现哪个接口?(D) A.ActionListener B.MouseListener C.MouseMotionListern D.ItemListener

二、填空题(每空1分,共20分)

1、面向对象程序设计所具有的基本特征是:___抽象性___,_封装性___,_继承性__,_多态性__ 2、数组x定义如下

int x[ ][ ]=new int[3][2] 则 x..length 的值为____3________, x[0].length 的值为_____2_______。

3、Java中实现多线程一般使用两种方法,一是___继承Thread类_________,二是_____实现Runnable方法__________

4、Java的图形用户界面设计中,有很多布局管理器用来摆放组件的位置,一般用到的布局管理器有(列出四种即可)__FlowLayout_____,___GridLayout_____,__BorderLayout_____,___CardLayout_______

5、Applet常用的方法是:__init()_、__run()__、__stop()__和destroy()。 三、阅读程序,写出程序的输出结果(每题5分,共20分) 1、class A{

private int privateVar; A(int _privateVar){ privateVar=_privateVar; }

boolean isEqualTo(A anotherA){

if(this.privateVar == anotherA.privateVar) return true; else

return false; }

.

.

}

public class B{

public static void main(String args[]){ A a = new A(1); A b = new A(2);

System.out.println(a.isEqualTo(b)); } }

程序的输出结果为:____false_____ 2、class A {

double f(double x, double y) { return x * y; } }

class B extends A {

double f(double x, double y) { return x + y; } }

public class Test {

public static void main(String args[]) { B obj = new B();

System.out.println(\ } }

程序的输出结果为:__ The program output is 10_ 3、public class Unchecked {

public static void main(String[] args) { try { method();

.

.

} catch (Exception e) { System.out.println(\ } finally {

System.out.println(\ } }

static void method() { try { wrench();

System.out.println(\

} catch (ArithmeticException e) { System.out.println(\ } finally {

System.out.println(\ }

System.out.println(\ }

static void wrench() {

throw new NullPointerException(); } }

程序的输出结果为: E A B

4、public class Test {

public static void main(String[] args) { int x;

int a[] = { 0, 0, 0, 0, 0, 0 }; calculate(a, a[5]);

.

.

System.out.println(\ System.out.println(\ }

static int calculate(int x[], int y) { for (int i = 1; i < x.length; i++) if (y < x.length) x[i] = x[i - 1] + 1; return x[0]; } }

程序的输出结果为: the value of a[0] is 0 the value is a[5] is 5

1. 下面哪些是short型的取值范围 [C] A. -27 – 27-1 B. 0 – 216-1 C. -215 – 215-1 D. -231 – 231-1

2. 下面哪些是合法的标识符 [ABE] A. $persons B. TwoUsers C. *point D. this E. _endline

3. 哪些是将一个十六进制值赋值给一个long型变量 [D] A. long number = 345L; B. long number = 0345; C. long number = 0345L;

.

  • 收藏
  • 违规举报
  • 版权认领
下载文档10.00 元 加入VIP免费下载
推荐下载
本文作者:...

共分享92篇相关文档

文档简介:

. 15、在复选框中移动鼠标,然后单击一选项,要捕获所选项必需实现哪个接口?(D) A.ActionListener B.MouseListener C.MouseMotionListern D.ItemListener 二、填空题(每空1分,共20分) 1、面向对象程序设计所具有的基本特征是:___抽象性___,_封装性___,_继承性__,_多态性__ 2、数组x定义如下 int x[ ][ ]=new int[3][2] 则 x..length 的值为____3________, x[0].length 的值为_____2_______。 3、Java中实现多线程一般使用两种方法,一是___继承Thread类_________,二是_____实现Runnable

× 游客快捷下载通道(下载后可以自由复制和排版)
单篇付费下载
限时特价:10 元/份 原价:20元
VIP包月下载
特价:29 元/月 原价:99元
低至 0.3 元/份 每月下载150
全站内容免费自由复制
VIP包月下载
特价:29 元/月 原价:99元
低至 0.3 元/份 每月下载150
全站内容免费自由复制
注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信:fanwen365 QQ:370150219
Copyright © 云题海 All Rights Reserved. 苏ICP备16052595号-3 网站地图 客服QQ:370150219 邮箱:370150219@qq.com