代码如下,输出结果都是5.....4,为什么第二个不是5.....5?谁给我解答一下,谢谢!
class Fu
{
int num = 4;
public int getNum()
{
return num;
}
}
class Zi extends Fu
{
int num = 5;
public int getNum()
{
return num;
}
void show()
{
System.out.println(this.num+"....."+super.getNum());
System.out.println(this.num+"....."+this.getNum());
}
}
class ExtendsDemo
{
public static void main(String[] args)
{
Zi z = new Zi();
z.show();
}
}
|
|