"SCJP 1.6版考題 104" 修訂間的差異
出自 陳富國維基館
(新頁面: Given: 10. class Line{ 11. public static class Point{} 12. } 13. 14. class Triangle{ 15. //insert code here 16. } Which code, inserted at line 15, creates an instance ...) |
(無差異)
|
於 2013年3月30日 (六) 05:38 的最新修訂
Given:
10. class Line{
11. public static class Point{}
12. }
13.
14. class Triangle{
15. //insert code here
16. }
Which code, inserted at line 15, creates an instance of the Point class defined in Line?
A. Point p = new Point();
B. Line.Point p = new Line.Point();
C. The Point class cannot be instatiated at line 15.
D. Line l = new Line(); l.Point p = new l.Point();
解答
Ans: B
解說: 由於Point是Line的類別成員,在存取Point是必須使用Line.Point
| ||||||||||||||||||||