JAVA期末考试试卷A答案

时间:2025-07-10

试卷

咸宁学院计算机科学与技术学院

2010年春季学期2009级计算机应用、软件工程

《面向对象程序设计》期末考试A卷答案

一、 填空(本题共15空,每空2分,共30分)

1.4,class 2.Float,Chararter,Boolean

3.final 4.新建、可执行、死亡、阻塞 5.Object 6.Universal Resource Locator。 7.Application、Applet 8.\

二、选择(本题共20小题,每题2分,共40分)

1.BBCBD ABCAC BDDDD BCACA

三、判断题(本题共5小题,每题2分,共10分)

下面的说法正确的打” √”,错误的打”X”

1.X √√√√

四、 编程题(本题共2小题,每题10分,共20分) 1.

import java.awt.FlowLayout;

import java.awt.event.ActionEvent;//--------加1分

import java.awt.event.ActionListener;

import javax.swing.JButton;

import javax.swing.JFrame;//--------加1分

public class ButtonTest implements ActionListener{//------加1分

JButton button1;

JButton button2;

public void initUI(){

JFrame jf = new JFrame();//-------按钮设置加2分

button1 = new JButton("不可见");

button2 = new JButton("不可用");

button1.addActionListener(this);

button2.addActionListener(this);

jf.setLayout(new FlowLayout());

jf.add(button1);

jf.add(button2);

jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

jf.setSize(200, 200);

jf.setLocationRelativeTo(null);

jf.setVisible(true);

}

public void actionPerformed(ActionEvent e) { //----加3分

if(e.getActionCommand().equals("不可见")){

button1.setVisible(false);

}if(e.getActionCommand().equals("不可用")){

button2.setEnabled(false);

}

JAVA期末考试试卷A答案.doc 将本文的Word文档下载到电脑

精彩图片

热门精选

大家正在看

× 游客快捷下载通道(下载后可以自由复制和排版)

限时特价:7 元/份 原价:20元

支付方式:

开通VIP包月会员 特价:29元/月

注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信:fanwen365 QQ:370150219