add more demo for creating new thred
This commit is contained in:
18
src/createthread/CreateByTimer.java
Normal file
18
src/createthread/CreateByTimer.java
Normal file
@@ -0,0 +1,18 @@
|
||||
package createthread;
|
||||
|
||||
import java.util.Timer;
|
||||
import java.util.TimerTask;
|
||||
|
||||
public class CreateByTimer {
|
||||
|
||||
public static void main(String[] args) {
|
||||
Timer timer = new Timer();
|
||||
|
||||
timer.schedule(new TimerTask() {
|
||||
@Override
|
||||
public void run() {
|
||||
System.out.println("create thread by using timer");
|
||||
}
|
||||
}, 0, 1000);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user