Mega Code Archive

 
Categories / Java Book / 001 Language Basics
 

0074 Alternative Array Declaration Syntax

The square brackets follow the type specifier, and not the name of the array variable. type[] var-name; For example, the following two declarations are equivalent: int al[] = new int[3]; int[] a2 = new int[3]; The following declarations are also equivalent: char d1[][] = new char[3][4]; char[][] d2 = new char[3][4];