Difference between type [] varName and type varName []?

Is there any difference between array division like

int[] array = new int[10];

and declaring it as

int array[] = new int[10];

?

Both are valid in Java, but I did not find any differences (initialization or something?), Or are they just two different ways to describe the same thing to the compiler?

+5
source share
3 answers

They make no difference, but this distinctive difference allows this:

int[] array; int[][] matrix;

===

int array[], matrix[][];

===

int[] array, matrix[];

Here is the link to the corresponding page: http://java.sun.com/docs/books/jls/third_edition/html/arrays.html#17235

+11
source

int array[] - , C , int[] array Java. .

java-: Java

+2

They both do the same.

+1
source

All Articles