A good answer might be:

for ( int index= egArray.length-1 ; index >= 0 ; index-- )

Reading in Each Element

Here is a program that prompts the user and reads in each element. For now, the array is required to be five elements long. After the array is filled with data, the array is written to the monitor.

import java.io.* ;

class inputArray
{

  public static void main ( String[] args ) throws IOException
  {

    int[] array = new int[5];
    int   data;

    BufferedReader inData = 
        new BufferedReader ( new InputStreamReader( System.in ) );

    // input the data
    for ( ___________ ; ________________ ; _____________ )
    {
      System.out.println( "enter an integer: " );
      data           = Integer.parseInt( inData.readLine() );
      array[ index ] = data ;
    }
      
    // write out the data
    for ( ___________ ; ________________ ; _____________  )
    {
      System.out.println( "array[ " + index + " ] = " + array[ index ] );
    }

  }
}      

Usually the program would have something in the middle to do "something" to the data. This would usually involve more loops.

QUESTION 4:

Fill in the blanks so that the program works as described.