zoukankan      html  css  js  c++  java
  • 定时器

    package com.funo.timer;

    import java.util.Timer;

    public class MyTimer {

        public static void main(String[] args) {
        Timer timer =new Timer();
        timer.schedule(new MyTimerTask(),2000,3000);
        
        }
        
    }

    //----------------------------------------------------------------

    package com.funo.timer;

    import java.text.SimpleDateFormat;
    import java.util.Date;
    import java.util.TimerTask;

    public class MyTimerTask extends TimerTask {

        @Override
        public void run() {
            SimpleDateFormat sdf =    new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
            System.out.println("doing timer task"+sdf.format(new Date()));
        }

    }

  • 相关阅读:
    SSH异常
    jquery效果摘要
    js随笔
    html随笔
    demo小样
    SVG图标
    jQuery笔记
    html / css学习笔记-3
    angular 学习笔记
    ng-route使用笔记
  • 原文地址:https://www.cnblogs.com/guolsblog/p/6103057.html
Copyright © 2011-2022 走看看