小弟初学求各位大虾帮忙看看哪里出的问题
class father{
private String a;
private int b;
father(){
this("haha",10);
}
father(String a,int b){
this.a=a;
this.b=b;
}
public void fshow(){
System.out.println(a);
System.out.println(b);
}
}
class son extends father{
private double c;
son(){
super("hehe",3);
c=5;
}
son(String a,int b,double c){
super("xxxx",2);
this.c=c;
}
public void show(){
fshow();
System.out.println(c);
}
}
public class test{
public static void main(String[] args){
father a=new son();
a.show();
}
}
为什么报错说是找不到方法show()??
父类对象引用变量创建子类对象不可以么调用子类方法么?
|