go to previous page   go to home page   go to next page

Answer:

for ( int index=0; index <x.length; index++ )

  if ( x[index] > max )

    max = x[index] ;


Using the Method

call by value
class ArrayDemo
{
  public static void main ( String[] args ) 
  {
    int[] ar1 =  { -20, 19, 1, 5, -1, 27, 19, 5 } ;

    ArrayOps operate = new ArrayOps();     // create an ArrayOps object

    int biggest = operate.findMax( ar1 );  // call findMax() with a reference to the array

    System.out.println("The maximum is: " + biggest );
  }

}      

The program demonstrates the ArrayOps class.


QUESTION 4:

What, exactly, is ar1 ?