Suppose a={1,2,3} and b={4,5,6} and I want to return an array containing the middle elements of a and b, i.e., {2,5}. I tried to use "merge":
public int[] middleValueArray(int[] a, int[] b) {
int[] both=merge(a[1],b[1]);
return both;
}
This does not seem to work. Is there a simple way to approach this? Thanks!
you can do it like this:
public int[] middleValueArray(int[] a, int[] b) {
int[] both=new int[]{a[1],b[1]};
return both;
}