package interfacePackage1.Test2;
public class Test {
public static void main(String[] args) {
}
class Car extends InterfaceTest.Car1 implements InterfaceTest.Car{
@Override
int getSpeed1() {
return 1;
}
}
}
package interfacePackage1.Test2;
public class InterfaceTest {
interface Car{
String type="柴油车";
void run();
}
abstract class Car1{
private int speed=6;
abstract int getSpeed1();
int getSpeed(){
return speed;
}
public void run(){
System.out.println("run");
}
}
}
报错:No enclosing instance of type 'interfacePackage1.Test2.InterfaceTest' is in scope
我不明白为什么加上了static以后就不报错了