class Super{
public float getNum(){return 3.0f;}
}
public class Sub extends Super{
public void getNum(){}
}
为什么这样写报错Sub类的返回类型与父类不一致,但换成了public void getNum(double d) {
class Super{
public float getNum(){return 3.0f;}
}
public class Sub extends Super{
public void getNum(){}//这边没有重写父类的getNum方法,也就是Sub类有2个getNum方法,那它调用哪个呢,所以它报错
}