• Post Reply Bookmark Topic Watch Topic
  • New Topic

Differnce between array declaration  RSS feed

 
Phillipe Rodrigues
Ranch Hand
Posts: 165
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is the basic difference between the below(1),(2)declarations?

int[] var;............................(1)
int var[];.............................(2)
 
fred rosenberger
lowercase baba
Bartender
Posts: 12529
48
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
the first one is perferred by most people, but otherwise, there isn't a difference.
 
Campbell Ritchie
Sheriff
Posts: 55351
157
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
According to somewhere on the Sun site int[] array is preferred because it makes it clear that the type of the variable is an array.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!