- public class Ch600 extends Thread {
-
- public void run()
- {
- for(int i=5; i>=1; i--)
- {
- System.out.println(i+"sec");
- try {
- sleep(1000);
- } catch (InterruptedException e) {}
- }
- System.out.println("times up");
- System.out.println("name: "+Thread.currentThread().getName());
- }
-
- public static void main(String[] args) {
- Ch600 app=new Ch600();
- app.start();
- //app.run();
- }
- }
複製代碼 |