Which code, inserted at line 16, correctly retrieves a local instance of a Point object?

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?

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?

A.
Point p = (new Line()).getPoint();

B.
Line.Point p = Line.getPoint();

C.
Point p = Line.getPoint();

D.
Line.Point p = (new Line()).getPoint();

Explanation:



Leave a Reply 0

Your email address will not be published. Required fields are marked *