我想问的是你的类是怎么实现的,如果是继承自Thread的话肯定是编译不通过的,因为Thread中的isDaemon()是final的,要是不是继承自Thread,也就是下面这样:
class Test {
public final boolean isDaemon() {
return false;
}
Thread t = new Thread();//当然你创建的Thread对象可能还传了别的参数
t.setDaemon(true);
System.out.println(t.isDeamon());//这里调的是Thread中的isDaemon()而不是你写的isDaemon()
t.start();
}