> 其他 >
现有两个类,父类为Person,子类为Chinese,Person中有如下的定义片段:
……
Stringname="noname";
publicPerson(){name="one man";}
publicPerson(String tmpname){name=tmpname;}
……
Chinese中有如下的定义片段:
……
publicChinese(int tmpage)
{
if(tmpage>=18)
{super();}
else
{super("achild");}
}
public StringgetName()
{
return name;
}
……
第三个类Demo是这样定义的:
publicclass Demo
{
public static void main(String args[])
{
Chinese c=new Chinese(25);
System.out.println("Thischinese's name is:"+c.getName());
}
}
程序进行编译执行时,会产生什么样的执行结果?
a.This chinese's name is:a man
b.This chinese's name is:a child
c.This chinese's name is:noname
d.编译运行过程出错
人气:162 ℃ 时间:2019-10-08 10:30:46
解答
这个程序编译都通不过
推荐
猜你喜欢
© 2024 79432.Com All Rights Reserved.
电脑版|手机版