Timer Use

. 1  Package com.ccp.Lc0815;
 2  
. 3  Import the java.util.Timer;
 . 4  Import java.util.TimerTask;
 . 5  
. 6  public  class Timers {
 . 7      public  static  void main (String [] args) {
 . 8          the Timer Timer = new new the Timer ( );
 . 9          // Schedule (do, delay time, frequency) 
10          timer.schedule ( new new MyTask (), 1000 ,   1000 );
 . 11      }
 12 is  
13 is  
14      static  class MyTask the extends the TimerTask {
15  
16          @Override
 . 17          public  void RUN () {
 18 is              . The System OUT .println ( " I need to repeatedly see notes " );
 19          }
 20      }
 21 }

 

Guess you like

Origin www.cnblogs.com/qsy0021/p/11361639.html