接口为什么不能用pulic修饰呢?
public interface Animal {
void run();
}
class Bird implements Animal {
public void run() {
System.out.println("鸟儿在飞...");
}
}
class Fish implements Animal {
public void run() {
System.out.println("鱼儿在游...");
}
}
public class TestAnimal {
public static void main(String[] args) {
Bird bird = new Bird();
bird.run();
Fish fish = new Fish();
fish.run();
}
}
|