Java 时间显示
package pukepai;
import javax.xml.crypto.Data;
import java.lang.annotation.Target;
import java.text.SimpleDateFormat;
import java.util.Date;
public class test1
{
public static void main(String args[])
{
TIme t1=new TIme();
Thread play=new Thread(t1);
play.start();
}
}
class TIme implements Runnable
{
int time=0;
SimpleDateFormat m=new SimpleDateFormat("hh:mm:ss");
Date date;
public void run()
{
while(true)
{
date=new Date();
System.out.println(date);
System.out.println(m.format(date));
System.out.println(time);
time++;
try
{
Thread.sleep(200);
}
catch (Exception e){}
}
}
}