aspose file tools*
The moose likes Beginning Java and the fly likes What is the difference between these statements Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "What is the difference between these statements" Watch "What is the difference between these statements" New topic
Author

What is the difference between these statements

Douglas Braxton
Ranch Hand

Joined: Jan 28, 2004
Posts: 36
private int a[ ];
and
private int[ ] a;
???
Rikard Qvarforth
Ranch Hand

Joined: Jul 10, 2001
Posts: 107
Well nothing really.. but i think the xxx[] a is more common for c++ programmers or was it the otherway ? humm dont remember but say an array of int "int[]" or an array of int but "int []x" i think its more clear if you put the bracets with the type.
well hope this helps in my dissoriented explaining and bad english
//Rille
Douglas Braxton
Ranch Hand

Joined: Jan 28, 2004
Posts: 36
so is "a" the name of the array?
fred rosenberger
lowercase baba
Bartender

Joined: Oct 02, 2003
Posts: 11422
    
  16

In this case, "a" would be the name of the array.
I think they adopted both ways since in C/C++, you'd declare an array more like the first way, but most people think the second is easier to read.


There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
 
 
subject: What is the difference between these statements