August 2003
Intermediate to advanced
672 pages
16h 23m
English
Array elements, like other variables, can store values of primitive data types or references to objects. In the latter case it means they can also be arrays, that is, array of arrays (see Section 4.1, p. 104). If an array element is of a primitive data type, then its data value is passed, and if it is a reference to an object, then the reference value is passed.
public class FindMinimum { public static void main(String[] args) { int[] dataSeq = {6,4,8,2,1}; int minValue = dataSeq[0]; for (int index = 1; index < dataSeq.length; ++index) minValue = minimum(minValue, dataSeq[index]); // (1) System.out.println("Minimum value: " + minValue); } public static ... |
Read now
Unlock full access