Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package be.xios.ladadv;
- public class Coordinate {
- private int x;
- private int y;
- //constructor
- public Coordinate(){
- x = 0;
- y = 0;
- }
- public Coordinate(int x, int y){
- this.x =x;
- this.y =y;
- }
- //getters
- public int getX(){
- return x;
- }
- public int getY(){
- return y;
- }
- //setters
- public void setX(int x){
- this.x = x;
- }
- public void setY(int y){
- this.y = y;
- }
- public String toString(){
- return "(" + x + ", " + y + ")";
- }
- public boolean equals(Object o){
- if (o == null){
- return false;
- }else if(this.getClass() != o.getClass()){
- return false;
- }else{
- Coordinate vgl = (Coordinate) o;
- return(this.x == vgl.getX() && this.y == vgl.getY());
- }
- }
- }
Add Comment
Please, Sign In to add comment