package com.Hanqi2; public class xiti { //颜色 private String Yanse; //大小 public String Daxiao; public String getYanse() { return Yanse; } public xiti() { System.out.println("调用父类的xiti()构造方法"); } public xiti(String Yanse,String Daxiao) { this.Yanse = Yanse; this.Daxiao = Daxiao; System.out.println("颜色是:"+this.Yanse+"\n大小为:"+Daxiao); } public void Call(int call) { System.out.println("Call: "+call); } }
package com.Hanqi2; public class xitizhs extends xiti { public xitizhs(String Yanse,String Daxiao) { super(Yanse,Daxiao); } public xitizhs() { System.out.println("调用父类的xitizhs()构造方法"); } public void Call(int call) { call = call - 1; System.out.println("Call--: "+call); } }
package com.Hanqi2; public class xiti3 extends xitizhs { public xiti3 () { System.out.println("调用父类的xiti3()构造方法"); } public xiti3(String Yanse, String Daxiao) { super(Yanse, Daxiao); } public static void main(String[] args) { xiti3 skk = new xiti3();//括号内无数据 自动读取前方全部父类 } }