This week's book giveaway is in the OCAJP forum.
We're giving away four copies of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) and have Khalid A Mughal & Rolf W Rasmussen on-line!
See this thread for details.
Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Initialization of array of arrays

 
René Hoielt Hansen
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

I have a question regarding initialization of an array of arrays (all_range). I get four arrays returned from a method and I would like to form a "table" by making a array of arrays.



Thanks for any help you could give me.
 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24212
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't know what your number "3" is supposed to represent, but in fact the correct thing to do is to omit the numbers altogether:

String[][] all_range = new String[][] {range,fo_range,op_range,unix_range};
 
René Hoielt Hansen
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks - it was so simple. I think the 3 is because I borrowed it from C# where syntax is similar but not identical.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic