2009年2月11日 星期三

第88題

第88題
Which Three statements are true? (Choose Three.)
A. A final method in class X can be abstract if and only if X is abstract.
B. A protected method in class X can be overridden by any subclass of X.
C. A private static method can be called only within other static methods in class X.
D. A non-static public final method in class X can be overridden in any subclass of X.
E. A public static method in class X can be called by a subclass of X without explicitly referencing the class X.
F. A method with the same signature as a private final method in class X can be implemented in a subclass of X.
G. A protected method in class X can be overridden by a subclass of X only if the subclass is in the same package as X.

答案:BEF
參考:6-5 繼承、7-3 存取修飾詞的使用、8-2 方法種類與呼叫方式

-----------------------------------------------------------------

B. 一個 protected 的 method 可以被任何子類別改寫. 不論是否在相同的package裡
E. 呼叫 static的方法 不需要透過物件來呼叫(explicitly referencing )
F. 此處只是簽章相同, 並不是用改寫, 所以OK

沒有留言:

張貼留言