标签:常用 exce 默认 cep class runnable start current 面向对象
常用其他方法public class n {
public static void main(String[]args) throws InterruptedException
{
System.out.println(Thread.currentThread().isAlive());
//设置名字,真实角色(面向对象方式设置)和代理角色(线程的默认名字0到10)
test t=new test("ha");
Thread tt=new Thread(t);
tt.setName("ff"); //设置的是代理角色名称
tt.start();
Thread.sleep(1000);
System.out.println(tt.isAlive());
}
}
class test implements Runnable{
private String name;
public test(String name)
{
this.name=name;
}
public void run()
{
System.out.println(Thread.currentThread().getName()+"-->"+name);
}
}
标签:常用 exce 默认 cep class runnable start current 面向对象
原文地址:https://blog.51cto.com/14437184/2429039