A good answer might be:

A parameter is data that is supplied to a method just before it starts running.

Array used as a Parameter

Here is a (nearly complete) program:

  1. It defines a class called ArrayOps.
    • ArrayOps contains a method print() to print out each element of an array.
    • The parameter list is: int[] x
      • This declares a formal parameter x which will be a reference to an array object.
      • The caller is expected to supply a reference to an array as an actual parameter

  2. It defines a class called ArrayDemo.
    • ArrayDemo holds the static main() class.
    • The static main() class creates an array object.
    • The static main() class creates an ArrayOps object, ar1.
    • The print() method of the ArrayOps object is "called" with a reference to the array object ar1 as a parameter.

import java.io.*;
class ArrayOps
{
  void print( int[] x )  // the parameter x refers to the data this method is
                         // called with.
  {
    for ( int ____________; _________________; ____________ )
      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 } ;

    System.out.print  ("\nThe array is: " );
    operate.print( ar1 );   // call the print() method of the object
  }

}      

QUESTION 2:

Fill in the blanks so that the method prints out each array element. It would benefit you enormously to try to get all the details correct.

Click Here after you have answered the question