Arrays

This is just a confirmation that Java has arrays. When you see a pair of square brackets like this [ ], it always means you're dealing with an array. The full description of arrays has its own chapter, Chapter 9.

An example array is the set commandline arguments, which is passed to the main() routine as an array of Strings.

void main(String[] args) { /* code */ }

The individual elements in an array can be any type: primitive or reference type. The array as a whole is an object in Java. That means array types are reference types, and an array variable is really a reference to an array object.

Get Just Java™ 2 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.