A good answer might be:

No effect at all. Other than for illustrating how Java works, this is not a very useful program.

Array Example

Here is another example program, this time using an array parameter. The program prints:

Before:
27 19 34 5 12
After:
0 19 34 5 12

The details of the program will be explained in a few pages. For now, just look at the broad outline of the program. What are the methods of a ChangeArray object? What do they do?

// Array Example
//
class ChangeArray
{
  void print ( int[] x )
  {
    for ( int j=0; j < x.length; j++ )
      System.out.print( x[j] + " " );
    System.out.println( );
  }

  void zeroElt ( int[] x, int elt )             // 6.
  {
    if ( elt < x.length )                       // 7.
      x[ elt ] = 0;                             // 8.
  }
}

class ChangeTest
{
  public static void main ( String[] args )     // 1.
  {
    ChangeArray cng = new ChangeArray();        // 2.
    int[] value = {27, 19, 34, 5, 12} ;         // 3.
    System.out.println( "Before:" );            // 4.
    cng.print( value );
    
    cng.zeroElt( value, 0 );                    // 5.
    System.out.println( "After:" );             // 9.
    cng.print( value );
  }
}

QUESTION 6:

Did the zeroElt() method change one of the array's elements?