返回列表 發帖
本帖最後由 李允軒 於 2016-10-1 17:35 編輯
  1. public class Ch122 extends Thread{
  2.         public void run(){
  3.                 for(int i=5; i>=1; i--){
  4.                         System.out.println(i+"秒");
  5.                         try{
  6.                                 Thread.sleep(1000);
  7.                         }catch(InterruptedException e){}
  8.                 }
  9.                 System.out.println("時間到");
  10.                 System.out.println("執行緒名稱: "+ Thread.currentThread().getName());
  11.         }
  12.         public static void main(String[] args) {
  13.                 Ch122 app=new Ch122();
  14.                 app.start();
  15.         }
  16. }
複製代碼
كخخخخخخخخخخخخخ

TOP

返回列表