Question
I alredy posted and get answered by chegg expert, but he didnt included comment for the code. So I have hard time to understand it.
A point representing a location (x, y) in coordinate space specified in integer precision. public class Point ( *, data fields * stores the (x, y) location of point private int x; private int y constructs and initializes a point at the origin (0,0) of the coordinate plane. * public Pointo this(0,0); calls constructor Pointint, int) constructs and initializes the point to the location specified * by point p. ' @param p reference to the specified point object public Point(Point p) setlocation(p): Il reduce redundancy with setLocation constructs and initializes the point to the specified (x.y) * location. @param x the x coordinate of point to construct. @param y the y coordinate of point to construct. public Point(int x, int y) ( setLocation( y)i reduce redundancy with setlocation returns the x coordinate of the point in integer precision. @returm x the x coordinate of point object . public int getxo ( retum x *returns the y coordinate of the point in integer precision. @return y the y coordinate of point object public int getyo ( return y " moves the point to the specified location in the (x, y) coordinate *plane. This method is identical to setLocation(int, int). @param x the specified x coordinate value. @param y the specified y coordinate value. public void move(int x, int y) this.x x this.y y changes the location of the point in the coordinate plane to the location specified by point p. @param p the specified point public void setLocation(Point p) x p.x; changes the location of the point in the coordinate plane to the location specified by the values (x y). "@param x the specified x coordinate value. " @param y the specified y coordinate value. public void setLocation(int x, int y) ( public class GenericClent public static void main(StringD args) ( TODO Auto-generated method stub Point p new Point(2,6 Generic
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started