单选题
关于下列代码编译或执行结果的描述中,正确的是______。
public class Test{
public static void main(String args[]){
TcstThread pml=new TestThread("One")
pm1. start()
TestThread pro2=new TestThread("Two")
pro2. 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. print (sTname+"");
}
}
}
【正确答案】
D
【答案解析】[解析] 启动两个线程,线程之间没有进行同步,所以B和C均有可能。