class demo
{
String leiXing = "狼" ;
String eat = "吃肉";
public void out()
{
System.out.println(this.leiXing + this.eat);
}
}
class demo1 extends demo
{
String leiXing = "猫";
String eat = "吃鱼刺";
}
class chengfeng
{
public static void main(String[] args)
{
demo z = new demo();
z.leiXing = "狗";
z.eat = "吃骨头";
z.out();
demo1 c = new demo1();
c.out();
}
}
(为什么最后输出的;猫吃鱼刺;变成了;狼吃肉)???哪个地方出现错误了 |
|