返回列表 發帖
  1. package bbs.istak.org.tw;

  2. import java.io.IOException;

  3. public class test {

  4.         public static void main (String[] arg0) throws InterruptedException, IOException{
  5.                
  6.                 System.out.println("START");
  7.                
  8.                 Thread time = new Thread();
  9.                 time.start();
  10.                
  11.                 System.out.println("FINISH");
  12.         }
  13. }
複製代碼
  1. package bbs.istak.org.tw;

  2. public class Tick extends Thread{
  3.        
  4.         public void run(){
  5.                
  6.                 for(int i = 10 ; i > 0 ; i--){
  7.                        
  8.                         System.out.println(i+"s");
  9.                         try {
  10.                                 Thread.sleep(1000);
  11.                         } catch (InterruptedException e) {
  12.                                 // TODO 自動產生的 catch 區塊
  13.                                 e.printStackTrace();
  14.                         }
  15.                 }
  16.                
  17.         }
  18. }
複製代碼

TOP

返回列表