-
-
Save ajduke/02703ab4fc73e7d7478d to your computer and use it in GitHub Desktop.
This file contains 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.concurrent.Executors; | |
import java.util.concurrent.ScheduledExecutorService; | |
import java.util.concurrent.TimeUnit; | |
public class Task3 { | |
public static void main(String[] args) { | |
Runnable runnable = new Runnable() { | |
public void run() { | |
// task to run goes here | |
System.out.println("Hello !!"); | |
} | |
}; | |
ScheduledExecutorService service = Executors | |
.newSingleThreadScheduledExecutor(); | |
service.scheduleAtFixedRate(runnable, 0, 1, TimeUnit.SECONDS); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment