并发编程之线程创建到销毁、常用API
//1.自定义一个类继承Thread类public class ExThread extends Thread { //2.重写run() @Override public void run() { for (int i = 0; i < 100; i++) { System.out.println(Thread.currentThread().getName()+”:”+i); } } public static void main(String[] args) { //3.创建Thread子类对象 ExThread exThread = new ExThread(); //4.调用start方法启动自定义线程 exThread.start(); } }