Question: Add the following method to the Point class: public String toString() Make it return a string in the following format. For example, if a Point

Add the following method to the Point class:

public String toString()

Make it return a string in the following format. For example, if a Point object stored in a variable pt represents the point (5, -17), return the string:

java.awt.Point[x=5,y=-17]

Your code is being added to the following class:

public class Point {

int x;

int y;

// your code goes here

}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!