I am new to programming and am just trying to work a bit with arrays. I am in the process of making the methods I want to use on the array, but when I try to pass the actual array through these methods I get the error in the title. What am I doing wrong?
public class ArrayPractice extends Arrays
{
double[] values = new double[11];
public static void main(String[] args)
{
//when methods are created run them each once for the array we created and then print out the result.
fillArray(values);
firstLastSwap(values);
System.out.println(values);
}
public void fillArray(double[] array)
{
for(int i=0; i<array.length; i++)
{
values[i] = Math.random();
}
}
public void firstLastSwap(double[] array)
{
double tempOne = array[0];
double tempTwo = array[array.length-1];
for(int i=0; i<array.length; i++)
{
if(i == array[0])
{
array[i] = tempTwo;
}
else if(i == array[array.length-1])
{
array[i] = tempOne;
}
}
}
public void shiftElementsLeft(double[] array)
{
}
public void evenElementsToZero(double[] array)
{
}
public void replaceWithBigNeighbor(double[] array)
{
}
}