Code: Test class
public class MyTestTimer {public static Timer mTimer;public static void main(String[] args) {mTimer=new Timer();MyTimerTask testTimer=new MyTimerTask(10000);mTimer.schedule(testTimer, 10000);}} TimerTask task class
public class MyTimerTask extends TimerTask{private int second;public MyTimerTask(int second) {this.second=second;}public void run() {System.out.println("I've been waiting for you"+second+"second");}}The above java's Timer and TimerTask simple demo (sharing) is all the content I share with you. I hope you can give you a reference and I hope you can support Wulin.com more.