我想做一个显示时间的程序代码秒在动 
代码如下 
import java.util.*;   
class TheadTest extends Thread{   
  public void run(){   
   Date d=new Date();   
   System.out.println(d);   
  }   
  public static void main(String[] args){   
    TheadTest t=new TheadTest();   
     t.start();   
      try{   
         Thread.sleep(1000);   
       }catch(Exception e){   
        e.printStackTrace();   
       }   
       finally  
      {   
          System.out.println("a");   
      }   
    }   
}  请个位大虾看看哪有错 
如果给出代码的话 
那就非常感谢 
感谢

解决方案 »

  1.   

    import java.util.*;  public class ThreadTest extends Thread{  
      public void run() {    
      System.out.print(new Date());   while(true)
      {
      System.out.print("\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"+new Date());  
          try{  
            Thread.currentThread().sleep(1000);  
          }catch(Exception e){  
            e.printStackTrace();  
          }  
      }
      }  
      public static void main(String[] args){  
        ThreadTest t=new ThreadTest();
        t.start();  
        }  
    }