O'Reilly logo

Programmer's Guide to Java™ Certification, A: A Comprehensive Primer, Second Edition by Rolf W. Rasmussen, Khalid A. Mughal

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

3.20. Passing Array References

Arrays are objects in Java (see Section 4.1, p. 100). A review of arrays is recommended before continuing with this section.

The discussion on passing object reference values in the previous section is equally valid for arrays. Method invocation conversions for array types are discussed along with those for other reference types in Section 6.6.

Example 3.5. Passing Arrays
 public class Percolate { public static void main (String[] args) { int[] dataSeq = {6,4,8,2,1}; // Create and initialize an array. // Write array before percolation. for (int i = 0; i < dataSeq.length; ++i) System.out.print(" " + dataSeq[i]); System.out.println(); // Percolate. for (int index = 1; index < dataSeq.length; ++index) if (dataSeq[index-1] ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required