aspose file tools*
The moose likes Beginning Java and the fly likes Differnce between array declaration Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Differnce between array declaration" Watch "Differnce between array declaration" New topic
Author

Differnce between array declaration

Phillipe Rodrigues
Ranch Hand

Joined: Oct 30, 2007
Posts: 165
What is the basic difference between the below(1),(2)declarations?

int[] var;............................(1)
int var[];.............................(2)


Thanks,
fred rosenberger
lowercase baba
Bartender

Joined: Oct 02, 2003
Posts: 11498
    
  16

the first one is perferred by most people, but otherwise, there isn't a difference.


There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 40052
    
  28
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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Differnce between array declaration