课后练习 求指导
父类 Shape
package com.imooc2;
public abstract class Shape {
private float a=5;
private float b=7;
private float d=10;
public abstract void L();
public abstract void S();
}
子类 Rectangle
package com.imooc2;
public class Rectangle extends Shape {
@Override
public void L() {
// TODO Auto-generated method stub
System.out.println("矩形的周长是:"+(a+b)); //在这里会报错
}
@Override
public void S() {
// TODO Auto-generated method stub
System.out.println("矩形的面积是:"+(a*b)); //在这里会报错
}
}
这是怎么回事啊? 求帮助。谢谢