3
answers
0
watching
218
views
6 Sep 2018

(g) Suppose I define a type Point which contains two properties, x and y. The Point class has both getters and setters defined on it which do the obvious thing of setting and getting x and y. Remember that the get (int index) method defined on an ArrayList will return a reference to the index element of the ArrayList. import java.util.ArrayList; public class ReferenceTest7 public static void methodSevenA (ArrayList coordinates) Point first - coordinates.get(0); first.set X (200.0); public static void methodsevenB (ArrayList coordinates) Point second = coordinates.get (1); second = new Point (5.0,100.0); second. setX (100); public static void main(String[] args) { ArrayList coordinates = new ArrayList(); coodinates.add(new Point (1.0,2.0)); coordinates.add(new Point(3.0, 4.0)); methodSevenA (coordinates); methodSeven (coordinates); System.out.println (coordinates.get (0).getX()); System.out.println (coordinates.get (1).getX()); 1/WHAT IS PRINTED TO THE SCREEN? (ANSWER IN CHART)

For unlimited access to Homework Help, a Homework+ subscription is required.

Unlock all answers

Get 1 free homework help answer.
Already have an account? Log in
Already have an account? Log in
Jarrod Robel
Jarrod RobelLv2
7 Sep 2018
Already have an account? Log in

Related questions

Related Documents

Weekly leaderboard

Start filling in the gaps now
Log in