August 2003
Intermediate to advanced
672 pages
16h 23m
English
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.
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] ... |
Read now
Unlock full access