多线程Thread(获取线程名字)

package com.day18.Thread;

public class ThreadFour {

    public static void main(String[] args) {
        new Thread("Lakers") {
            public void run() {
                System.out.println(this.getName()+"  Kobe");
            }
        }.start();
        
        new Thread("Celtics") {
            public void run() {
                System.out.println(this.getName()+"  KG");
            }
        }.start();
    }

}

 

posted @ 2018-07-06 22:59  简简单单zjl  阅读(3458)  评论(0编辑  收藏  举报