public class Java_2
{
public static void main(String[] args)
{
Thread t = new SimpleThread("Testing_Thread");
//*********Found**********
t.start();
}
}
//*********Found**********
class SimpleThread extends Thread
{
public SimpleThread(String str)
{
//*********Found**********
setName(str);
}
//*********Found**********
public void run()
{
System.out.println("Running the " + getName() + ":");
for (int i = 0; i < 5; i++)
{
System.out.println("---" + i + "---" + getName());
try
{
sleep((int)(2 * 100));
}
//*********Found**********
catch(InterruptedException e) { }
}
}
}
Java二级操作题 输出线程名称2
猜你喜欢
转载自blog.csdn.net/qq_38945163/article/details/81355371
今日推荐
周排行