方法1
Thread t = new Thread(new Runnable(){
@Override
public void run() {
//...
}
});
t.setName("线程名称");
t.start();
方法2
new Thread(new Runnable() {
@Override
public void run() {
//..
}
},"线程名称").start();
Thread t = new Thread(new Runnable(){
@Override
public void run() {
//...
}
});
t.setName("线程名称");
t.start();
new Thread(new Runnable() {
@Override
public void run() {
//..
}
},"线程名称").start();
转载于:https://my.oschina.net/Howard2016/blog/1608757