Last active
December 22, 2016 04:03
-
-
Save chaseberry/ddbd9d335f6dbaa3055197efffd7ef18 to your computer and use it in GitHub Desktop.
JPoint
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class JPoint { | |
private int x = 0; | |
private int y = 0; | |
public JPoint() { | |
} | |
public JPoint(int x, int y) { | |
this.x = x; | |
this.y = y; | |
} | |
@Override | |
public boolean equals(Object obj) { | |
return obj instanceof JPoint && ((JPoint) obj).getX() == getX() && ((JPoint) obj).getY() == getY(); | |
} | |
@Override | |
public String toString() { | |
return "JPoint(x=" + x + ", y=" + y + ")"; | |
} | |
public int getX() { | |
return x; | |
} | |
public void setX(int x) { | |
this.x = x; | |
} | |
public int getY() { | |
return y; | |
} | |
public void setY(int y) { | |
this.y = y; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment