阅读背景:

2019.10.10

来源:互联网 

1.继承

代码:
package MyThread;

public class Myextends extends Thread{
    public Myextends(String name) {
        super(name);
    }
    public void run() {
        for(int i=0;i<3;i++) {
            System.out.println(this.getName()+"打印信息"+i);
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                // TODO 自动生成的 catch 块
                e.printStackTrace();
            }
        }
    }
    public static void main(String[] args) {
        Myextends thread1=new Myextends("线程1");
        Myextends thread2=new Myextends("线程2");
        thread1.start();
        thread2.start();
    }
}代码:
package MyThread;

public class Myext



你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: