考试第五题

复制代码
package test05;

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

public class Demo implements Runnable{

    @Override
    public void run() {
        // TODO Auto-generated method stub
        
        Date date = new Date();
        
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("HH:mm:ss");
    
        String s = simpleDateFormat.format(date);
        System.out.println(s);
    }
    public static void main(String[] args) {
        Demo d = new Demo();
        
        while(true) {
            
            Thread t = new Thread(d);
            try {
                t.sleep(1000);
            } catch (InterruptedException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
            t.start();
            
        }
        
    }
    

}
复制代码

 

本文作者:AxeBurner

本文链接:https://www.cnblogs.com/bichen-01/p/11336301.html

版权声明:本作品采用知识共享署名-非商业性使用-禁止演绎 2.5 中国大陆许可协议进行许可。

posted @   AxeBurner  阅读(99)  评论(0编辑  收藏  举报
点击右上角即可分享
微信分享提示
💬
评论
📌
收藏
💗
关注
👍
推荐
🚀
回顶
收起
  1. 1 404 not found REOL
404 not found - REOL
00:00 / 00:00
An audio error has occurred.