And the code I typed for it is given below:
class MyPoint {
public int x;
public int y;
public MyPoint(){
x = 0;
y = 0;
}
public MyPoint(int x, int y) {
this.x = x;
this.y = y;
}
public void setXY(int newx, int newy) {
x = newx;
y = newy;
}
public int[] getXY() {
int [] getXYarray = new int[2];
getXYarray[0] = x;
getXYarray[1] = y;
return getXYarray;
}
public String toString() {
return "(" + x + "," + y + ")";
}
But i cannot see what is actually wrong here.
Please tell me where i am going wrong with this as i am very lost.