My code does not give errors, however it is not displaying the minimum and maximum values. The code is:
Scanner input = new Scanner(System.in);
int array[]
You are doing two mistakes here.
1. calling getMaxValue(),getMinValue()
methods before array initialization completes.
2.Not storing return value returned by the getMaxValue(),getMinValue()
methods.
So try this code
for (int i = 0 ; i < array.length; i++ )
{
int next = input.nextInt();
// sentineil that will stop loop when 999 is entered
if (next == 999)
break;
array[i] = next;
}
// get biggest number
int maxValue = getMaxValue(array);
System.out.println(maxValue );
// get smallest number
int minValue = getMinValue(array);
System.out.println(minValue);