In: Computer Science
Write the definition of a Point class method called clone that takes NO arguments and returns a new Point whose x and y coordinates are the same as the Point’s coordinates.
class Point { int x; int y; public Point(int x, int y) { this.x = x; this.y = y; } @Override public String toString() { return "(" + x + ", " + y + ")"; } public Point clone() { return new Point(x, y); } }
************************************************** Thanks for your question. We try our best to help you with detailed answers, But in any case, if you need any modification or have a query/issue with respect to above answer, Please ask that in the comment section. We will surely try to address your query ASAP and resolve the issue.
Please consider providing a thumbs up to this question if it helps you. by Doing that, You will help other students, who are facing similar issue.