public class Test_C3
{
public static void main(String[] args)
{
T t = new T();
t.setName("小牛");
t.start();
for(int i=0;i<30;++i)
{
System.out.println("嘿嘿");
System.out.printf("%s线程被调用\n",Thread.currentThread().getName());
}
}
}
class T extends Thread
{
public void run()
{
for(int i=0; i<30;++i)
{
System.out.printf("哈哈\n");
System.out.printf("%s线程被调用\n",Thread.currentThread().getName());
}
}
} |