O'Reilly logo

Java, A Beginner’s Guide, 5th Edition by Herbert Schildt

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Alternative Array Declaration Syntax

There is a second form that can be used to declare an array:

type[ ] var-name;

Here, the square brackets follow the type specifier, not the name of the array variable. For example, the following two declarations are equivalent:

Image

The following declarations are also equivalent:

Image

This alternative declaration form offers convenience when declaring several arrays at the same time. For example,

Image

This creates three array ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required