package zuoye3;
public class Person {
private String name; private int age; private String gender; public Person(){ System.out.println("无参"); } public Person(String name,int age,String gender){ this.name=name; this.age=age; this.gender=gender; } public String getName(){ return name; } public void setName(String name){ this.name=name; } public int getAge(){ return age; } public void setAge(int age){ this.age=age; } public String getGender(){ return gender; } public void setGender(String gender){ this.gender=gender; }}package zuoye3;
public class zi extends Person{
public zi(String name,int age,String gender){ super(name,age,gender); }}package zuoye3;
public class Testdome {
public static void main(String[] args){ zi a=new zi("年后",20,"男"); System.out.println("姓名 "+a.getName()+" 年龄 "+a.getAge()+" 性别 "+a.getGender()); }}