Answers for "how to do a timer in java"

3

java timer

timer.schedule(new TimerTask() {
  @Override
  public void run() {
    // Your database code here
  }
}, 2*60*1000);
// Since Java-8
timer.schedule(() -> /* your database code here */, 2*60*1000);
Posted by: Guest on November-08-2020
2

java do something after x seconds without stopping everything else

new java.util.Timer().schedule( 
        new java.util.TimerTask() {
            @Override
            public void run() {
                // your code here
            }
        }, 
        5000 
);
Posted by: Guest on August-19-2020
1

java timer

import java.util.Timer;
Posted by: Guest on November-08-2020

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language