I want to return odd numbers of an array yet Eclipse doesn\'t seem to accept my return array[i]; code. I think it requires returning a whole array since I set a
array[i];
Make sure return type of you method is same what you want to return. Eg: `
public int get(int[] r) { return r[0]; }
`
Note : return type is int, not int[], so it is able to return int.
In general, prototype can be
public Type get(Type[] array, int index) { return array[index]; }