继承Thread类
package com.chen.lesson01;
public class Demo01 extends Thread{
@Override
public void run() {
for (int i = 1; i < 100; i++ ){
System.out.println("这是run"+i);
}
}
public static void main(String[] args) {
Demo01 demo01 = new Demo01();
demo01.start();
for (int i = 1; i < 2000; i++ ){
System.out.println("这是start"+i);
}
}
}
[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-EmZw4RNv-1605315959056)(C:\Users\MACHENIKE\AppData\Roaming\Typora\typora-user-images\image-20201107093104483.png)]
一起运行