Hi im trying to make a program that passes an array to a method. the method then finds the smallest number in the array and passes that number back to the main where its printed out. I am getting an error saying: "error: number cannot be resolved to a variable". I am using drjava. here is my code.
import java.util.*;
public class homeWorkTwo{
public static void main(String[] args)
{
int[] arrayA;
arrayA = new int[10];
arrayA[0]=7;
arrayA[1]=5;
arrayA[2]=8;
arrayA[3]=9;
arrayA[4]=2;
arrayA[5]=10;
arrayA[6]=11;
arrayA[7]=1;
find_sum(arrayA);
//int lowestNumber = find_sum(number);
//System.out.print("The smallest number is: "+lowestNumber);
}
public static int find_sum(int [ ] arrayA){
int isItSmaller=0;
int small=0;
for(int i=0;i<=7;i++){
isItSmaller=arrayA[i];
if(small<isItSmaller){}
else
small=isItSmaller;
}
System.out.print(small);
return small;
}
}