package com
;
public class Test
{
public
static void main(String
[] args
) {
ThreadTest01 t
=new
ThreadTest01();
t
.doSome();
Thread thread1
= Thread
.currentThread();
System
.out
.println(thread1
);
MyThread thread
=new
MyThread();
thread
.setName("tttt");
System
.out
.println(thread
.getName());
thread
.start();
}
}
class MyThread extends Thread
{
@Override
public
void run(){
for (int i
= 0; i
< 1000; i
++) {
Thread thread
= Thread
.currentThread();
System
.out
.println("分支线程对象"+thread
.getName());
System
.out
.println("分支线程"+i
);
}
}
}
class ThreadTest01
{
public
void doSome(){
System
.out
.println("--------->"+Thread
.currentThread().getName());
}
}
转载请注明原文地址: https://lol.8miu.com/read-23135.html