A good answer might be:

The filled blanks are below.


Testing Strings for Equality

The if statement skips over slots that contain null. Otherwise, the method tests if slot j of the array refers to a string that matches target. In other words, we want to test if the contents of two strings are equal.

class Searcher
{
  // seek target in the array of strings.
  // return the index where found, or -1 if not found.
  public static int search( String[] array, String target )
  {
     for ( int j=0; j  < array.length; j++ )
       if ( array[j] != null )
         // do something here with a non-null slot

  }
}

class SearchTester
{
  public static void main ( String[] args )
  {
    . . . . . .
    int where = Searcher.search( strArray, "Peoria" );
    . . . . . .
  }
}

QUESTION 18:

Which of the following evaluates to true when array[j] refers to a string that is the equivalent of the one that target refers to?