清华大佬耗费三个月吐血整理的几百G的资源,免费分享!....>>>
public class Test extends Thread { public void run() { printMsg(); } public void printMsg() { // 获得运行此代码的线程的引用 Thread t = Thread.currentThread(); String name = t.getName(); System.out.println("name = " + name); } public static void main(String[] args) { Test t = new Test(); t.setName("MyThread"); System.out.println("线程状态 = " + t.isAlive()); t.start(); System.out.println("线程已启动..."); System.out.println("线程状态 = " + t.isAlive()); } }