how can I return two values in java ?
for (int i = 1; i < prob.length; i++) {
x=x+xprob[i];
y=y+yprob[i];
}
return x,y;
thanks
how can I return two values in java ?
for (int i = 1; i < prob.length; i++) {
x=x+xprob[i];
y=y+yprob[i];
}
return x,y;
thanks
Either return an isntance of a class whose attributes are x and y, or an array of two elements.
Example :
public int[] func ()
{
int[] arr = new int[2];
...
arr[0] = x;
arr[1] = y;
return arr;
}