本帖最后由 hy19985125 于 2012-6-4 10:56 编辑
public class C{
public final String a;
public final String b;
public C(String a, String b){
this.a = a;
this.b = b;
}
public void play(){
System.out.println("a="+a);
}
public void sleep(){
System.out.println("b="+b);
}
public void d(){
new Thread(){
public void run(){
while(true){
play();
sleep();
}
}
}.start();
}
public static void main(String[] args){
new C("a", "b").d();
}
}
编译报错,不知道错在哪里,程序本该开启一个死循环线程,不断的执行play();sleep();
但是编译报错,求解!!!! |
|