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();
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();
}
}
错误提示是
分享到:
------解决方案-------------------- ActionListener 是不是还有一个方法你没有实现 actionPerformed ------解决方案-------------------- 我去
你是不是单词写错了 少了一个m ------解决方案-------------------- 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();
}