I'm trying to form a method to call on a object to check if it contains some of the attributes in the class
This is the code that I've tried so far
public class BoundingBox {
public int x, y, width, height;
public BoundingBox() {
}
public Integer getX() {
return x;
}
public void setX(Integer x) {
this.x = x;
}
public Integer getY() {
return y;
}
public void setY(Integer Y) {
this.y = y;
}
public boolean contains(int x, int y) {
if (x == getX() & y == getY()) {
return true;
} else {
return false;
}
}
}
However when I created the object with all attributes holding the value of 10 and tested it using object.contains(15,15), it does not return false