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:

Declare it. Write the array identifier ...

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

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.