首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
下面程序是关于类的继承的用法。阅读下面程序,根据程序中的注释在每一条横线处填写一个语句,使程序的功能完整,且运行程序后的输出结果为: I am parentclass! I am childclass! I am childclass! 注
下面程序是关于类的继承的用法。阅读下面程序,根据程序中的注释在每一条横线处填写一个语句,使程序的功能完整,且运行程序后的输出结果为: I am parentclass! I am childclass! I am childclass! 注
admin
2009-01-15
31
问题
下面程序是关于类的继承的用法。阅读下面程序,根据程序中的注释在每一条横线处填写一个语句,使程序的功能完整,且运行程序后的输出结果为:
I am parentclass!
I am childclass!
I am childclass!
注意: 请勿改动main()主方法和其他已有的语句内容,仅在下划线处填入适当的语句。
class Parent {
void printMe() {
System.out.println("I am parentclass!");
}
}
class Child extends Parent {
void printMe() {
System.out.println("I am childclass!");
}
void printAll() {
______________.printMe ( ); // 调用父类的方法
______________. printMe ( ); //调用本类的方法
printMe ( );
}
}
public class TestJieCheng {
public static void main(String args[]) {
______________
myC.printAll();
}
}
选项
答案
super this Child myC=new Child();
解析
本题主要考查super,this关键字以及如何生成对象。解答本题的关键是熟练super,this的用法、对象的生成。在本题中, super.printMe();语句的功能是调用父类的printMe()方法,this.printMe();语句的功能是调用本类的printMe()方法,Child myC=new Child();语句的功能是生成Child类的对象myC。
转载请注明原文地址:https://jikaoti.com/ti/SJb0FFFM
本试题收录于:
二级Java题库NCRE全国计算机二级分类
0
二级Java
NCRE全国计算机二级
相关试题推荐
设有关系歌手(歌手号,姓名,最后得分)和关系评分(歌手号,分数,评委号),每个歌手的最后得分是所有评委给出的分数的平均值,则计算歌手“最后得分”的SQL语句是
使用如下数据表:学生.DBF:学号(C,8),姓名(C,6),性别(C,2),出生日期(D)选课.DBF:学号(C,8),课程号(C,3),成绩(N,5,1)设有学生(学号,姓名,性别,出生日期)和选课(学号,课程号,成绩)两个关系,计算刘明同学选修
下列程序段执行以后,内存变量X和Y的值是CLEARSTORE3TOXSTORE5TOYSETUDFPARMSTOREFERENCEDOPLUSWITH(X),Y?X,YPROCEDUREPLUSPARAMET
下列排序方法中,最坏情况下比较次数最少的是
在考生文件夹下完成如下简单应用:1.通过一对多表单向导新建一个名为sport_form的表单。要求:把“国家”作为父表并选择“国家名称”字段作为显示字段,“获奖牌情况”为子表并选择“项目名称”和“名次”字段作为显示字段,通过“国家代码”
在考生文件夹下完成如下简单应用:1.modil.prg程序文件中SQLSELECT语句的功能是查询目前用于3个项目的零件(零件名称),并将结果按升序存入文本文件results.txt中。给出的SQLSELECT语句中在第1、3、5行各有一处错
使用如下关系:客户(客户号,名称,联系人,邮政编码,电话号码)产品(产品号,名称,规格说明,单价)订购单(订单号,客户号,订购日期)订购单名细(订单号,序号,产品号,数量)假设客户表中有客户号(关键字)C1~C10共10条客户记录,订购单表有订
数据库管理系统中负责数据模式定义的语言是
一个模块直接调用的下层模块的数目称为模块的()。
对长度为8的数组进行快速排序,最多需要的比较次数为()。
随机试题
患儿,男,9岁。前牙反牙合求治。侧面观凹面型,上颌后缩,下颌基本正常。口内检查:前牙反牙合,双侧磨牙近中尖对尖,下颌不可退至对刃。反覆牙合该患者早期治疗的主要目标中最次要的是
A.内毒素B.溶血素C.肠毒素D.卵磷脂酶E.TSST-1霍乱弧菌的致病因素
下列与类风湿关节炎活动无关的是
急性肺水肿典型x线表现是()
某蓄电池厂磨粉工,工龄14年,近半年来出现头痛、头昏、肌肉关节酸痛、手指麻木等症状,化验室检查有轻度贫血,该患可考虑诊断为
根据《建设工程质量管理条例》,下列符合建设单位质量责任和义务的有()。
区别于一般人力资源管理,工程项目人力资源管理的特性有()。
下面是某求助者的SCL一90测验结果:总分201阳性项目教56测验结果显示,该求助者可能存在()。
设(X,Y)的联合概率密度为求
Whendidthefilmbegin?
最新回复
(
0
)