课后题

class Thread1

package Xiancheng;

public class Thread1 extends Thread{
    
    public void run()
    {
        for(int i=0;i<10;i++)
        {
            System.out.println("钓到"+i+"条鱼");
            try {
                Thread.sleep(100);
            } catch (InterruptedException e) {
                
                e.printStackTrace();
            }
        }
    }

}
View Code

class Test2

package Xiancheng;

public class Test2 {

    public static void main(String[] args) {
        
        Thread1 t1=new Thread1();
        t1.start();
    }

}
View Code

原文地址:https://www.cnblogs.com/1ming/p/5279972.html