package com.lbx.email;
import java.util.Timer;
import java.util.TimerTask;
public class Test2 {
private final Timer timer = new Timer();
private final int minutes;
public Test2(int minutes) {
this.minutes = minutes;
}
public void start() {
timer.schedule(new TimerTask() {
public void run() {
playSound();
timer.cancel();
Test2 eggTimer = new Test2(2);
eggTimer.start();
}
private void playSound() {
System.out.println("Your egg is ready!");
// Start a new thread to play a sound...
}
}, minutes * 1 * 1000);
}
public static void main(String[] args) {
Test2 eggTimer = new Test2(1);
eggTimer.start();
}
}