"SCJP 1.6版考題 072" 修訂間的差異
出自 陳富國維基館
(新頁面: 1. package geometry; 2. public class Hypotenuse { 3. public InnerTriangle it = new InnerTriangle(); 4. class InnerTriangle { 5. public int base; 6. public int height;...) |
(無差異)
|
於 2013年3月30日 (六) 06:24 的修訂
1. package geometry; 2. public class Hypotenuse { 3. public InnerTriangle it = new InnerTriangle(); 4. class InnerTriangle { 5. public int base; 6. public int height; 7. } 8. } Which statement is true about the class of an object that can reference the variable base? A. It can be any class. B. No class has access to base. C. The class must belong to the geometry package. D. The class must be a subclass of the class Hypotenuse.
解答
Ans: E
解說:
要存取變數base的話… 因base是類別InnerTriangle 的成員,InnerTriangle 存取屬性是預設(套件), 因此要存取base變數的類別必須是跟InnerTriangle 同一個套件下的類別。
|