返回列表 發帖
  1. public class Ch600 extends Thread {
  2.       
  3.         public void run()
  4.         {
  5.                 for(int i=5; i>=1; i--)
  6.                 {
  7.                         System.out.println(i+"sec");
  8.                         try {
  9.                                 sleep(1000);
  10.                         } catch (InterruptedException e) {}
  11.                 }
  12.                 System.out.println("times up");
  13.                 System.out.println("name: "+Thread.currentThread().getName());      
  14.         }
  15.       
  16.         public static void main(String[] args) {
  17.                 Ch600 app=new Ch600();
  18.                 app.start();
  19.                 //app.run();
  20.         }
  21. }
複製代碼

TOP

返回列表