import java.util.Timer;
import java.util.TimerTask;
public class Main {
Timer timer;
public Main(int seconds) {
timer = new Timer();
timer.schedule(new ToDoTask(), seconds * 1000);
}
class ToDoTask extends TimerTask {
public void run() {
System.out.println("working");
timer.cancel();
}
}
public static void main(String args[]) {
new Main(5);
}
}
|