Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

What is the difference between these statements  RSS feed

 
Douglas Braxton
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
private int a[ ];
and
private int[ ] a;
???
 
Rikard Qvarforth
Ranch Hand
Posts: 107
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
so is "a" the name of the array?
 
fred rosenberger
lowercase baba
Bartender
Posts: 12441
42
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!