求大神解答
南橘ryc 2018-12-05 02:11:01 package bookdemov1;
public class VectorDemo {
public static void main(String[] args) throws InterruptedException {
Boss boss = new Boss(100);!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*****************8
AttackThread[] threads = new AttackThread[10];
threads[1].start();
}
class Boss {
public int hp;
public Boss(int hp) {
this.hp = hp;
}
public synchronized void hited() {
this.hp -= 6;
}
}
class AttackThread extends Thread {
private Boss boss;
public AttackThread(Boss boss) {
this.boss = boss;
}
public void run() {
for (int i = 0; i < 10; i++) {
boss.hited();
}
}
}
}
打!!!!!!!!***********号那一栏出现了问题
No enclosing instance of type VectorDemo is accessible. Must qualify the allocation with an enclosing instance of type VectorDemo (e.g. x.new A() where x is an instance of VectorDemo).
请问要怎么才能解决呀!
求大神指导