go to previous page   go to home page   go to next page

Answer:

Yes.


Method Changing an Element

parameter passing

 

There is only one array, and the method has a reference to it. The method is able to change the elements of the array, as the picture shows.

The difference between the first program and this example program is that arrays are objects. When a method is called with an object reference (like value), the method gets a reference to the object and can change the object (if the object allows changes.)

Some objects do not allow any changes, such as String objects. So a method can't change them even though it has a direct reference to the object.


QUESTION 8:

If main() had the following method call, what would happen to the array?

cng.zeroElt( value, 4 );

go to previous page   go to home page   go to next page