- package bbs.istak.org.tw;
- import java.io.IOException;
- public class test {
- public static void main (String[] arg0) throws InterruptedException, IOException{
-
- System.out.println("START");
-
- Thread time = new Thread();
- time.start();
-
- System.out.println("FINISH");
- }
- }
複製代碼- package bbs.istak.org.tw;
- public class Tick extends Thread{
-
- public void run(){
-
- for(int i = 10 ; i > 0 ; i--){
-
- System.out.println(i+"s");
- try {
- Thread.sleep(1000);
- } catch (InterruptedException e) {
- // TODO 自動產生的 catch 區塊
- e.printStackTrace();
- }
- }
-
- }
- }
複製代碼 |