📜  Person[] people = in java 代码示例

📅  最后修改于: 2022-03-11 14:52:43.003000             🧑  作者: Mango

代码示例1
System.out.println ("\nPolymorphism:");
Person[] persons = { new Person("Abu"), 
                     new Student ("Ben", 222), 
                     new Staff ("Carlo", 3000),
                     new Lecturer ("Donna", 5000, "TCP1101")
                    };
for (Person obj: persons)
   System.out.println (obj.toString());