java核心技术得代码自己照着输一遍有错误 错误提示在 ActionListener listener=new TimePrinter();


package diliuzhang;


import java.awt.*;

import java.awt.event.*;

import java.util.*;

import javax.swing.*;

import javax.swing.Timer;

public class TimerTest {


public static void main(String[] args) {

ActionListener listener=new TimePrinter();

Timer t=new Timer(10000,listener);

t.start();

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

System.exit(0);

}

class TimePrinter implements ActionListener{

public void actionPerformed(ActionEvent event) {

System.out.println("At the tone,tjis time is"+new Date());

Toolkit.getDefaultToolkit().beep();

}

}

}


慕瓜4170288
浏览 808回答 2
2回答
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Java