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 |