publicclassDemoCreateThreadextendsThread{@Overridepublicvoidrun(){for(int i =0;i<10;++i){
System.out.println("多线程"+i);}}publicstaticvoidmain(String[] args){//创建一个线程对象newDemoCreateThread().start();//调用start 方法开始多线程for(int i =0;i<100;++i){
System.out.println("public static void main 主线程"+i);}}}
多线程创建及理解1 自定义线程类集成Thread类2重写run()方法3 创建线程对象,调用start 方法启动线程public class DemoCreateThread extends Thread{ @Override public void run() { for (int i =0;i<10;++i){ System.out.println("多线程"+i); } } public sta