请帮忙看下课后作业,如何用到继承
父类 package com.imooc; public class traffic { int planeSpeed; int planeAccount; public int getPlaneSpeed() { return planeSpeed; } public void setPlaneSpeed(int planeSpeed) { this.planeSpeed = planeSpeed; } public int getPlaneAccount() { return planeAccount; } public void setPlaneAccount(int planeAccount) { this.planeAccount = planeAccount; } public void show(){ this.setPlaneAccount(planeAccount=100); this.setPlaneSpeed(planeSpeed=1000); System.out.println("飞机的速度"+planeSpeed); System.out.println("飞机的载客数量"+planeAccount); } }
package com.imooc; public class testing { /** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub traffic run1=new traffic(); run1.show(); } }
子类我不知道怎么用到,为什么show方法放到子类里,测试程序就无法调用show方法