关于下列代码编译或执行结果的描述中,正确是______。 public class Test{ public static void mai
关于下列代码编译或执行结果的描述中,正确是______。
public class Test{
public static void main(String args[]){
TestThread pm1=new TestThread("one");
pm1.start();
TestThread pm2=new TestThread("Tow");
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) 输出Tow One One Two
D) 选项B或C都可能出现