4.4. Arrays

Arrays work somewhat differently in Java than in ColdFusion. To begin with, they start at zero, rather than one. Second, once created, arrays cannot be resized.

All arrays in Java are one-dimensional. You can create multidimensional arrays as you would in ColdFusion by simply storing one array as the cell value of another. Arrays can be manipulated using the java.util.Arrays class, which exposes such methods as equals(), fill(), and sort()—all of which we use in upcoming code examples.

Arrays are references to objects. The arrays you create can be populated with primitive types or with references to objects.

4.4.1. Creating Arrays of Primitive Types

There are three steps to creating an array:

1.
Declare it. Write the array identifier ...

Get Java™ for ColdFusion® Developers now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.