A good answer might be:

19 1 5 -1 27

Error Checking

The method assumes that the user will supply correct data for the parameters. But users do not always follow the rules. The following call will not work:

    operate.printRange( ar1, 1, 10 );
There are only eight elements of ar1. If you asked to print elements 1 through 10 you would see:
19 1 5 -1 27 19 5 java.lang.ArrayIndexOutOfBoundsException
When the method tries access the non-existing 8th element, the program throws an exception. Here is the method, again, with some new blanks:

class ArrayOps
{
  . . .

  // print elements start through end
  void printRange ( int[] x, int start, int end )
  {
    for ( int index=start; index < end && ___________ && ___________; index++  )
      System.out.print( x[index] + " " );
    System.out.println();
  }

}

The new version of the method should make sure that index is not less than zero, and is not greater than the length of the array.

QUESTION 10:

Compete the new, improved method.

Click Here after you have answered the question