Last active
February 16, 2016 08:08
-
-
Save skumjava/e7c2672c70eff7c46e6b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import java.util.Timer; | |
| import java.util.TimerTask; | |
| public class JavaTimer { | |
| public static void main(String[] args){ | |
| Timer timer = new Timer(); | |
| TimerTask task = new TimerTask() { | |
| @Override | |
| public void run() { | |
| System.out.println("Inside Timer Task" + System.currentTimeMillis()); | |
| } | |
| }; | |
| System.out.println("Current time" + System.currentTimeMillis()); | |
| timer.schedule(task, 10000,1000); | |
| System.out.println("Current time" + System.currentTimeMillis()); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment