A . calls the method super as defined in the current class
B . calls the method super as defined in the current class'parent class
C . calls the method super as defined in java.lang
D . calls the constructor as defined in the current class
E . calls the constructor as defined in the current class'parent classhtml
思考:instruction super表示对当前类的父类中某些内容的调用。由于除了super()以外没有消息,因此它是对父类构造函数的调用。java
2.Inheritance through an extended (derived) class supports which of the following concepts?git
A . interfaces
B . modulary
C . information hiding
D . code reuse
E . correctness程序员
思考:经过扩展类并从中继承,新类没必要从新实现任何继承的方法或实例数据,从而节省程序员的工做量。所以,代码重用是指经过扩展别人的代码以知足您的须要,从而为您的利益重用别人的代码的能力。编程
3.Which of the following is an example of multiple inheritance?服务器
A . A computer can be a mainframe or a PC
B . A PC can be a desktop or a laptop
C . A laptop is both a PC and a portable device
D . A portable device is a lightweight device
E . Macintosh and IBM PC are both types of PCs数据结构
思考:多重继承意味着给定的类继承自多个父类。在上面列出的这些中,笔记本电脑继承了我的电脑和便携式设备的特性。A、B和E中的答案都是单个继承的例子,其中一个类至少有两个子类(在A中,计算机有子大型机和PC,在B中,PC有子台式机和笔记本电脑,在E中,PC有子Macintosh和IBM PC)。答案d表示类的属性。函数
4.If a programmer writes a class wanting it to be extended by another programmer, then this programmer must学习
A . change private methods and instance data to be protected
B . change public methods and instance data to be protected
C . change all methods to be protected
D . change the class to be protected
E . none of the above, the programmer does not have to change anythingthis
思考:受保护项可由定义它们的类的任何子类访问,而私有项不能由任何其余类访问。所以,之前定义的私有项如今必须受到保护。之前定义的公共实体应该保持公共,以便全部其余类仍然能够访问这些公共实体。之前定义的私有项不该该公开,由于这将容许全部类访问它们,而不只仅是子类。
5.The relationship between a parent class and a child class is referred to as a(n) ________ relationship.
A . has-a
B . is-a
C . was-a
D . instance-of
E . alias
思考:术语“is-a”用于表示子类是父类的一种类型。例如,研究生就是一种类型的学生。子类是更具体的类型。has-a关系指的是类的属性或元素(例如,学生有gpa),instance of指的是类与该类的实例化对象之间的关系。没有一个WAS-A关系,一个别名表示引用同一个对象或实例的两个变量。
6.Why shouldn't an abstract method be declared final?
A . There's nothing wrong with doing so
B . Abstract methods cannot be overridden and they must be if a concrete class ever is to be instantiated
C . So long as the Abstract method never actually is used in by any other method, there's no problem with doing this
D . So long as the Abstract method is declared in a Class (not an Interface), there's nothing wrong with doing this
E . None of the above
思考:为了使抽象方法成为具体的,必须重写它。将方法声明为final使其没法重写。这是一个矛盾,是被禁止的。
总结:其实我列举出来的问题只是本周学习中的一些具备表明性,思考型的错误,一些关于基础知识点的错误我根本就没有罗列,知识点的错漏仍是太大了。
点评过的同窗博客和代码
代码行数(新增/累积) | 博客量(新增/累积) | 学习时间(新增/累积) | 重要成长 | |
---|---|---|---|---|
目标 | 5000行 | 30篇 | 400小时 | |
第五周 | 1588/2698 | 2/9 | 34/133 |