What will be returned by getSmallest(…) method when you run this program?
Shiro0521 opened this issue · comments
`import java.util.Scanner;
public class ArrayMethods
{
static Scanner kb = new Scanner (System.in);
public static void main(){
int[] arr = {12, 44, 13, 26, 24, 22, 33, 11, 25, 5, 37, 41};
int min = getSmallest(arr, 0, 6);
}
public static int getSmallest(int [] arr, int a, int b){
int minNum=arr[a];
for(int index = a + 1; a < b; a++)
if(arr[index] < minNum)
minNum = arr[index];
return minNum;
}
}
`