0

I think I have seen both patterns in Java:

int array[] = { 1, 2, 3 };
int[] array = { 1, 2, 3 };

Are they both correct? Why are they both correct? Is one of them preferred/recommended?

My question is: when does the [] go after the type, and when does the [] go after the identifier when initialising arrays?

theonlygusti
  • 11,032
  • 11
  • 64
  • 119

0 Answers0