多態數組:數組
Person[] person = {new Person("張三", 32), new Student("李四", 21, 120, 90.0), new Student("王五", 22, 119, 91.5), new Teacher("劉老師", 35, 10, "Java EE"), new Teacher("張老師", 11)};
多態參數——方法參數列表中的引用類型參數spa
public static void method(Person p) {//形參 System.out.println(p.say()); } // 調用此方法: Student s = new Student(); xxx.method(s);