package com.atguigu.app;
import java. awt.*;
import java.awt.event.*;
import java.util.*;
import javax.swing.*;
import javax.swing.Timer;
public class InnerClass {
public static void main (String[] args){
TalkingClock clock=new TalkingClock(1000,true);
clock.start();
JOptionPane.showMessageDialog(null, "quit program");
System.exit(0);
}
}
class TalkingClock{
public Talking (int inerval,boolean beep){
this.interval=interval;
this.beep=beep;
}
public void start(){
ActionLister listener=new TimePrinter();
Timer t=new Timer(interval,listener);
t.start;
}
private int interval;
private boolean beep;
private class TimerPrinter implenents ActionListener
{
public void actionPerforme(ActionEvent event){
Date now=new Date();
System.out.println("At the tone,time is"+now);
if (beep) Toolkit .getDefaultToolkit().beep();
}
}
}
程序仍然报错。