Line | |
---|
1 | package testcode;
|
---|
2 |
|
---|
3 | import java.util.Timer;
|
---|
4 | import java.util.TimerTask;
|
---|
5 |
|
---|
6 | import org.eclipse.jdt.annotation.NonNull;
|
---|
7 |
|
---|
8 | class MyTask extends TimerTask {
|
---|
9 |
|
---|
10 | @Override
|
---|
11 | public void run() {
|
---|
12 | System.out.println("ok1");
|
---|
13 | }
|
---|
14 |
|
---|
15 | }
|
---|
16 |
|
---|
17 | /**
|
---|
18 | * Checks around sub-classes
|
---|
19 | */
|
---|
20 | public class DoTimer {
|
---|
21 |
|
---|
22 | static public void main(String[] args) throws InterruptedException {
|
---|
23 | final @NonNull Timer timer = new Timer("test timer");
|
---|
24 | final @NonNull TimerTask task = new MyTask();
|
---|
25 | timer.schedule(task, 1000);
|
---|
26 | Thread.sleep(1500);
|
---|
27 | }
|
---|
28 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.