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
最新推荐文章于 2024-05-17 09:53:35 发布