题目内容:
请阅读下面程序,说明该程序创建线程使用的方法是( )。 public class ThreadTest
{
public static void main(String args[])
{
Thread tl=new Thread(new HolloWorld());
Thread t2=new Thread(new HolloWorld());
tl.start();
t2.Start();
}
}
class HolloWorld implements Runnable
{
int i;
public void run()
{
while(true)
{
System.out.println("HolloWorld"+i++);
if(i= =5)break;
}
}
} A.继承Thread类
B.实现Runnable接口
C.tl.start()
D.t2.start()
参考答案:
答案解析: