Oracle
1Z0-851 · Question #11
Given: 10. class Line { 11. public class Point { public int x,y;} 12. public Point getPoint() { return new Point(); } 13. } 14. class Triangle { 15. public Triangle() { 16. // insert code here 17. }…
The correct answer is D. Line.Point p = (new Line()).getPoint(). See the full explanation below for the reasoning.
Question
Given: 10. class Line { 11. public class Point { public int x,y;} 12. public Point getPoint() { return new Point(); } 13. } 14. class Triangle { 15. public Triangle() { 16. // insert code here 17. } 18. } Which code, inserted at line 16, correctly retrieves a local instance of a Point object?
Options
- APoint p = Line.getPoint();
- BLine.Point p = Line.getPoint();
- CPoint p = (new Line()).getPoint();
- DLine.Point p = (new Line()).getPoint();
How the community answered
(35 responses)- A14% (5)
- B6% (2)
- C9% (3)
- D71% (25)
Community Discussion
No community discussion yet for this question.