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:
The following declarations are also equivalent:
This alternative declaration form offers convenience when declaring several arrays at the same time. For example,
This creates three array ...
Get Java, A Beginner's Guide, 5th Edition, 5th Edition 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.