-2

For example if you schedule in Python you just have to import time, then do time.sleep(seconds) and then your good to go. I've tried to do some similar things in Java, but it never worked.

skelet0n
  • 17
  • 5

2 Answers2

0

Can you try code sleep 3s :

public class Main {
   public static void main(String[] args) {
      try {
        Thread.sleep(3000);
      } catch (InterruptedException ex) {
        System.out.println("Error");
      }
  }
}
huunhancit
  • 119
  • 1
  • 3
  • It didn't work, it said: Main.java:13: error: unreported exception InterruptedException; must be caught or declared to be thrown Thread.sleep(3000); ^ 1 error – skelet0n Dec 11 '17 at 03:28
  • 1
    `public class Main { public static void main(String[] args) { try { Thread.sleep(3000); } catch (InterruptedException ex) { System.out.println("Error"); } } }` please try run codea again – huunhancit Dec 11 '17 at 03:31
  • @huunhancit Please don't "correct" code by posting a comment, [edit] your original answer. – Jim Garrison Dec 11 '17 at 04:35
0

You can user class Timer java Ref: https://docs.oracle.com/javase/7/docs/api/java/util/Timer.html Or use http://www.quartz-scheduler.org/

huunhancit
  • 119
  • 1
  • 3