Last active
August 29, 2015 13:57
-
-
Save ajduke/9889914 to your computer and use it in GitHub Desktop.
desc
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
public class Task1 { | |
public static void main(String[] args) { | |
// run in a second | |
final long timeInterval = 1000; | |
Runnable runnable = new Runnable() { | |
public void run() { | |
while (true) { | |
// ------- code for task to run | |
System.out.println("Hello !!"); | |
// ------- ends here | |
try { | |
Thread.sleep(timeInterval); | |
} catch (InterruptedException e) { | |
e.printStackTrace(); | |
} | |
} | |
} | |
}; | |
Thread thread = new Thread(runnable); | |
thread.start(); | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment