实现秒钟的不断的跳转的思路

来源:互联网 发布:魔兽数据修改器 编辑:程序博客网 时间:2024/05/17 04:32
package com.huxin.io.replenish;/* * 如何让时间的秒钟一直在跳? */import java.util.Date;public class DateTest { public static void main(String[] args) {    new Thread(new Time()).start(); }}class Time implements Runnable{ String s = null; public void run() {  while(true){   Date d = new Date();   s = d.toString().substring(11, 19);   System.out.println(s);   try {    Thread.sleep(1000);   } catch (InterruptedException e) {    e.printStackTrace();   }  } }} 


 

原创粉丝点击