栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 面试经验 > 笔试题库

[填空题] 请完善程序(程序文件名:Java

笔试题库 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

[填空题] 请完善程序(程序文件名:Java

[填空题] 请完善程序(程序文件名:Java_3.java)并进行调试。请在下画线处填入正确内容,然后删除下画线。请勿删除注释行和其他已有的语句内容。

题目要求:

程序运行的窗口(如下图所示)。

并在命令行窗口中每隔1秒显示一下当前时间,类似:

At the tone, the time is Tue Dec 29 11:40:12 CST 2009

At the tone, the time is Tue Dec 29 11:40:13 CST 2009

At the tone, the time is Tue Dec 29 11:40:14 CST 2009

在单击“确定”按钮时自动退出程序。

源程序:

import java.awt.*;

import java.awt.event.*;

import java.util.*;

import javax.swing.*;

import javax.swing.Timer;

public class Java_3

public static void main(String[]args)

ActionListener listener=new (1) ();

Timer t=new Timer(1000, listener);

t.start();

JOptionPane.showMessageDialog(null, "Quit program");

System.exit(0);

class

正确答案:

implements

参考解析:

因为类中用到了ActionListener的方法actionPerformed,所以TimePrinter实现了ActionListener接口,实现接口需要用implements关键字。

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/578313.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号