SCJP 1.6版考題 088

出自 陳富國維基館
前往: 導覽搜尋
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.

解答


Ans: B E F

解說:

那三個敘述是正確的?
A protected method in class X can be overridden by any subclass of X.
一個在類別X中的protected方法可以被X的任意子類別覆寫
 
A public static method in class X can be called by a subclass of X without explicitly referencing the class X.
在類別X中的公開靜態方法可以在類別X的子類別中被呼叫,不需要明確地參考類別X

A method with the same signature as a private final method in class X can be implemented in a subclass of X.
類別X中一個私有的finale方法可以在類別X的子類別中被實作出來(這表示這個私有的final方法是抽象的)