package shiyan3_2;
class Manager extends Staff { public static float bonus;
public void setBonus(float bonus){ this. = bonus; }
public float getBonus(){ return this.; }
public String toString(){
return super.toString() + ',' + this.; } }
package shiyan3_2;
public class shiyan3_2 {
public static void main(String[] args) { Staff s = new Staff(); s.setName("himi"); s.setNum("2010"); s.setPay(1000.0f);
System.out.println(s.toString());
Manager m = new Manager(); m.setName("Steve"); m.setNum("2012"); m.setPay(5000.0f); m.setBonus(1000.0f);
System.out.println(m.toString()); } }
运行结果是: