Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Array Initilaize  RSS feed

 
Vijay Kumar
Ranch Hand
Posts: 260
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
can any body tell me the difference between in these statement
String arr[][]
String [][]arr

Thanks
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There is no difference.
 
Sanjaya Sugiarto
Ranch Hand
Posts: 229
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Both are the same.
The String[][] arr is recommended because it is more readable though
 
Vijay Kumar
Ranch Hand
Posts: 260
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
if there is no differnce why these two are given .......
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A little subtility though, is when you declare several variables together.

String arr[][], bob;
is equivalent to
String arr[][];
String bob;

whereas
String [][] arr, bob;
is equivalent to
String [][] arr;
String [][] bob;
 
Vijay Kumar
Ranch Hand
Posts: 260
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks kurinosuke ....
:0
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!