问题
单项选择题
下列代码编译或执行结果的描述中,正确的是()。
class Test
public static void main(String args[])
TestThread pm1=new TestThread("One");
pm1.start();
TestThread pm2=new TestThread("Two");
pm2.start();
class TestThread extends Thread
private String sTname="";
TestThread(String s)
sTname=s;
public void run()
for(int i=0;i<2;i++)
try
sleep(1000);
catch (InterruptedException e)
System.out.println(sTname+" ");
A.不能通过编译,TestThread类中不能定义变量和构造方法
B.输出 One One Two Two
C.输出 Two One One Two
D.选项B或C都有可能出现
答案
参考答案:D