关于继承抽象父类的问题啊!!!
[code=Java][/code]
public abstract class s {
public abstract void gets();
}
class Sanjiao extends s{
double l,h;
Sanjiao(double l,double h){
this.l=l;
this.h=h;
}
public void gets(){
System.out.println(0.5*l*h);
}
public static void main(String[] args) {
Sanjiao p=new Sanjiao(2.1,3.5);
gets();//就是这一行有问题
}
}
------解决方案--------------------
Sanjiao p=new Sanjiao(2.1,3.5);
Sanjiao q=new Sanjiao(210,350);
p.gets();
q.gets();
这样就好理解点了吧