// : c04:ArrayClassObj.java
// Creating an array of nonprimitive objects.
// From 'Thinking in Java, 3rd ed.' (c) Bruce Eckel 2002
// www.BruceEckel.com. See copyright notice in CopyRight.txt.
import java.util.Random;
publicclass ArrayClassObj {
static Random rand = new Random();
publicstaticvoid main(String[] args) {
Integer[] a = newInteger[rand.nextInt(20)];
System.out.println("length of a = " + a.length);
for (int i = 0; i < a.length; i++) {
a[i] = newInteger(rand.nextInt(500));
System.out.println("a[" + i + "] = " + a[i]);
}
}
} ///:~