public class Holt extends Thread{ private String sThreadName;
public static void main(String argv[]){
Holt h = new Holt();
h.go(); }
Holt(){}
Holt(String s){
sThreadName = s; }
public String getThreadName(){
return sThreadName; }
public void go(){
Holt first = new Holt("first");
first.start();
Holt second = new Holt("second");
second.start(); }
public void start(){
for(int i = 0; i < 2; i ++){
System.out.println(getThreadName() +i);
try{
Thread.sleep(100); }
catch(InterruptedException e){
System.out.println(e.getMessage());
}
} } }
當(dāng)編譯運(yùn)行上面的Java代碼時(shí),將會(huì)出現(xiàn)()。
A.編譯時(shí)錯(cuò)誤
B.輸出first0, second0, first0, second1
C.輸出first0, first1, second0, second1
D.運(yùn)行時(shí)錯(cuò)誤