//父类 class Animal{ private String name; private int age; Animal(String name, int age) {//创建父类构造器 super(); this.name = name; this.age = age; } public String setName(){//传递参数 return name; } public int setAge(){//传递参数 return age; } } //子类 class Fish ext…
以下程序执行的结果是: class X{ Y y=new Y(); public X(){ System.out.print("X"); } } class Y{ public Y(){ System.out.print("Y"); } } public class Z extends X{ Y y=new Y(); public Z(){ System.out.print("Z"); } public static void main(Stri…