声明接口类型的数组
interface Walkable { void walk(); } /*来 自 N o w J a v a . c o m - 时 代 Java*/ class Person implements Walkable { private String name; public Person(String name) { this.name = name; } public void walk() { System.out.println(name + " (a person) is walking."); } } class Duck implements Walkable { private String name; public Duck(String name) { /** 来 自 N o w J a v a . c o m - 时 代 Java **/ this.name = name; } public void walk() { System.out.println(name + " (a duck) is walking."); } } class Walkables { public static void letThemWalk(Walkable[] list) { for (Walkable w : list) { w.walk(); } } } public class Main { public static void main(String[] args) { Walkable[] w = new Walkab