1,Thread的API:
2,注意:
- 这个方法是Thread的静态方法,推荐使用类名调用;
-
3,使用:
public class Text05 {public static void main(String[] args) {Thread thread = new Thread(new Runnable() {@Overridepublic void run() {}});thread.start();//多个线程时,一定要先获取线程对象,后获取名称//获取当前的线程Thread thread1 = Thread.currentThread();//并获取当前线程的名称;System.out.println(thread1.getName());}}
