Thursday, February 25, 2010

Best Practice of Java Array Declaration

To declare a array in Java, you have following options:
  1. dataType[] variableName;
  2. dataType variableName[];
  3. dataType []variableName;
The 1st is clearly related to how Java actually works, and you can read it as "dataType array variableName".

The conclusion is:
  • dataType[] variableName;
  • dataType[][]...[] arrayName;
Java, JavaScript, HTML, XHTML, AJAX, CSS, etc.