Question: Write a class Point that has x and y coordinates as private data. Write a constructor for the class and a toString method. Write
Write a class Point that has x and y coordinates as private data. Write a constructor for the class and a toString method. Write a main() method that uses the constructor to set a Point object to x=2, x = 3 and uses the toString method to display the coordinates of the Point object via System.out.println(objectname);
Step by Step Solution
3.41 Rating (145 Votes )
There are 3 Steps involved in it
Python class Point def initself x y selfx x selfy y def getxself return selfx def setxself x selfx x def getyself return selfy def setyself y selfy y ... View full answer
Get step-by-step solutions from verified subject matter experts
