creech42

Untitled

Mar 14th, 2023 (edited)
19
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. public class Point
  2. {
  3. private int x;
  4. private int y;
  5.  
  6. public Point()
  7. {
  8. x = 0;
  9. y = 0;
  10. }
  11.  
  12. public Point(int a, int b)
  13. {
  14. x = a;
  15. y = b;
  16. }
  17.  
  18. // Other Methods not shown
  19. }
  20.  
  21. public class NamedPoint extends point
  22. {
  23. private String name; // name of point
  24.  
  25. // Constructors go here
  26.  
  27. // Other methods not shown
  28.  
  29. }
  30.  
  31. I. public NamedPoint()
  32. {
  33. name = "";
  34. }
  35.  
  36. II. public NamedPoint(int d1, int d2, String pointName)
  37. {
  38. x = d1;
  39. y = d2;
  40. name = pointName;
  41. }
  42.  
  43. III. public NamedPoint(int d1, int d2, String pointName)
  44. {
  45. super(d1, d2);
  46. name = pointName;
  47. }
Advertisement
Add Comment
Please, Sign In to add comment