package xuexi;
public abstract class Shape {
public int a=20;
public int b=30;
public int r=4;
final double PI=3.14;
}
package xuexi;
public abstract class Rectangle extends Shape{
public void Zhouchang()
{System.out.println("周长为:"+(a+b)*2);
}
}
子类不是拥有父类的属性和方法了么,为什么第二个代码输出语句a,b报错,我用this.a不行,Shape.this.a也不行
慕运维8021912
慕粉4309445
qq_放肆青春_03307463
gylhaut
kaguya
慕的地6079101
慕工程6005648
慕工程6005648
慕工程6005648
相关分类