4
package LHB.inherit; public class Electricityfees { private int lastmonth,thismonth;/*上月电表读数,本月电表读数*/ public Electricityfees() { } public Electricityfees(int lastmonth,int thismonth) { this.lastmonth=lastmonth; this.thismonth=thismonth; } public int getLastmonth() { return lastmonth; } public void setLastmonth(int lastmonth) { this.lastmonth = lastmonth; } public int getThismonth() { return thismonth; } public void setThismonth(int thismonth) { this.thismonth = thismonth; } public void print() { System.out.print("上月电表读数为:"+lastmonth+" "); System.out.println("这个月电表读数为:"+thismonth+" "); } }