这个程序错在哪里了?
import java.awt.*;
import java.awt.event.*;
import java.util.*;
import javax.swing.*;
import javax.swing.Timer;
public class Test
{
public static void main(String[] args)
{
ActionListener listener = new A();
// A listener = new A(); //为什么不是这样?
Timer t = new Timer(10000, listener);
t.start();
JOptionPane.showMessageDialog(null, "Quit program?");
System.exit(0);
}
}
class A implements ActionListener
{
public void actionPerfored(ActionEvent event)
{
Date now = new Date();
System.out.println("At the tone, the time is " + now);
Toolkit.getDefaultToolkit().beep();
}
}
错误提示是
[解决办法]
楼主用eclipse直接生成未是实现的方法就不会错了~actionPerformed
[解决办法]