题目内容
完成程序功能,使得输出结果为:PersonPersonEmployeeEmployee程序源代码为:package view;class Person {void work() {System.out.println("Person");}}class Employee extends Person{void work(){System.out.println("Employee");}void work2(){System.out.println("work2");}}class Controller{static void personWork(Person p) {p.work();}}public class Test{public static void main(String[] args) {Controller.personWork(new Person());[] persons = new Person[3];persons[0]= new Person() ;persons[1]= new Employee() ;persons[2]= new Employee() ;for(Person p:persons)2(p);}}
查看答案
搜索结果不匹配?点我反馈