wood burning stoves 2.0*
The moose likes Beginning Java and the fly likes Initialization of array of arrays Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Initialization of array of arrays" Watch "Initialization of array of arrays" New topic
Author

Initialization of array of arrays

René Hoielt Hansen
Greenhorn

Joined: Apr 20, 2009
Posts: 2
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

Joined: Jul 08, 2003
Posts: 24183
    
  34

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};


[Jess in Action][AskingGoodQuestions]
René Hoielt Hansen
Greenhorn

Joined: Apr 20, 2009
Posts: 2
Thanks - it was so simple. I think the 3 is because I borrowed it from C# where syntax is similar but not identical.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Initialization of array of arrays
 
Similar Threads
Arrays in Java
illegal start of expression -- arrays
Array declaration
array as an object?
doubt in Array construction