next up previous index
Next: Arrays of Objects Up: Arrays Previous: Equality   Index


Arrays as Parameters

Array variables can be used as parameters to methods. When an array is passed in this way, a copy is made of the actual parameter. Since this is only a reference to the array, only the reference is copied, which makes for efficient passing of arrays to methods. The method now has access to the elements of the array, via the reference, which means that they can be changed as the method chooses. The reference itself, however, will not be changed outside the method.



Peter Williams 2005-06-07