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

array dimensions  RSS feed

 
Anandh Ramesh
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,

i have a two dimensional array, say data[][].

i want to extract the data in data[i], i.e., the entire rows.

how do i do it?
 
Keith Lynn
Ranch Hand
Posts: 2409
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Anandh Ramesh:
hi,

i have a two dimensional array, say data[][].

i want to extract the data in data[i], i.e., the entire rows.

how do i do it?


Just keep in mind that the two dimensional array is an array of arrays. So data[i] is an array itself. So you would access its members like you would other arrays.
 
Kaydell Leavitt
Ranch Hand
Posts: 690
Eclipse IDE Firefox Browser Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here is an example of an array of arrays

String[][] twoDimensionalArray = new String[10][12];

Here is an example of how to get one of the arrays from the array of arrays.

String[] oneDimensionalArray = twoDimArray[5];

-- Kaydell
[ November 25, 2006: Message edited by: Kaydell Leavitt ]
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!