A good answer might be:

New lines are inserted into the program, as below.

Parameter Connected to New Data

In the revised program, the print() method is used first with one array, and then with the other array. This is possible because the parameter x of the method refers to the current array, whichever one is used in the method "call."

import java.io.*;
class ArrayOps
{
  void print( int[] x )
  {
    for ( int index=0; index < x.length; index++ )
      System.out.print( x[index] + " " );
    System.out.println();
  }
}

class ArrayDemo
{
  public static void main ( String[] args ) 
  {
    ArrayOps operate = new ArrayOps();
    int[] ar1 =  { -20, 19, 1, 5, -1, 27, 19, 5 } ;
    int[] ar2 =  { 2, 4, 1, 2, 6, 3, 6, 9 } ;

    System.out.print  ("\nThe array is: " );
    operate.print( ar1 );  // method call with the 1st array

    System.out.print  ("\nThe second array is: " );
    operate.print( ar2 );   // method call with the 2nd array
  }

}      

The program will print the following:

C:\>java ArrayDemo
The array is:-20 19 1 5 -1 27 19 5

The second array is: 2 4 1 2 6 3 6 9

QUESTION 4:

  1. Did the two arrays have to contain the same number of elements?
  2. Did the two arrays both have to be arrays of int?

Click Here after you have answered the question