标签:str name thread current color adf class ble system
package com.day18.Thread; public class ThreadFive { public static void main(String[] args) { new Thread() { public void run() { System.out.println(getName()+" Kobe");//Thread-0 Kobe } }.start(); new Thread(new Runnable() { public void run() { //Thread.currentThread()获取当前正在执行的线程 System.out.println(Thread.currentThread().getName()+" KG");//Thread-1 KG } }).start(); System.out.println(Thread.currentThread().getName());//main //setName()方法可以修改线程的名字 Thread.currentThread().setName("修改后的主线程的名字"); System.out.println(Thread.currentThread().getName());//修改后的主线程的名字 } }
标签:str name thread current color adf class ble system
原文地址:https://www.cnblogs.com/zhujialei123/p/9275887.html