Why am I getting an "invalid method declaration; return type required" error on check(values); ?
public class Swap
{
int[] values = {5, 6, 7, 8, 9};
check(values);
public void swapAdjacentElemnts(int[] values)
{
for(int i=0; i<values.length - 1; i+=2)
{
int tempInt = values[i];
values[i] = values[i+1];
values[i+1]=tempInt;
}
}
public int[] check(int[] values)
{
swapAdjacentElements(values);
return values;
}
}