Advertisement
Guest User

Untitled

a guest
Feb 16th, 2019
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.70 KB | None | 0 0
  1. import java.util.Arrays;
  2. public class Point {
  3. protected int x;
  4. protected int y;
  5.  
  6. public Point(int x, int y){
  7. this.x = x;
  8. this.y = y;
  9. }
  10. public String toString(){
  11. String text = "["+x+","+y+"]";
  12. return text;
  13. }
  14. public String toStringOther(){
  15.  
  16. return Arrays.toString(new int[]{x, y});
  17. }
  18. public void setPoint(int x, int y){
  19. this.x = x;
  20. this.y = y;
  21. }
  22. public int getX(){
  23. return this.x;
  24. }
  25. public int getY(){
  26. return this.y;
  27. }
  28. public static void main(String args[]) {
  29. Point point = new Point(5, 10);
  30. System.out.println(point);
  31. }
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement