Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Differnce between array declaration

 
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
Pie
Posts: 12098
30
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: 48652
56
  • 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