Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.company;
- import java.text.DateFormat;
- import java.text.SimpleDateFormat;
- import java.util.Date;
- import java.util.Timer;
- import java.util.TimerTask;
- class Scheduler extends TimerTask {
- public void run() {
- System.out.println("RUN!!!");
- }
- }
- public class Main {
- public static void main(String[] args) throws Exception {
- DateFormat dateFormatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
- Date date = dateFormatter.parse("2021-08-19 12:26:00");
- var timer = new Timer();
- final long period = 10000;
- timer.schedule(new Scheduler(), date, period);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement