import javax.swing.Timer;
import java.awt.event.ActionEvent;

public class CallbackTest {
    public static void main(String[] args) {
        Timer t = new Timer(1000, (ActionEvent event) -> System.out.println("beep"));
        t.start();
        
        for (int i = 0; i < 10; i++) {
            try { 
                Thread.sleep(1000); 
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }
}
