aspose file tools*
The moose likes Java in General and the fly likes multidim array initialize Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "multidim array initialize" Watch "multidim array initialize" New topic
Author

multidim array initialize

Miran Cvenkel
Ranch Hand

Joined: Nov 23, 2010
Posts: 147
2D array, first dim = string, the second = array


Searchable nature photo gallery: http://agrozoo.net/jsp/Galery.jsp?l2=en
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19692
    
  20

Because your reference only has two dimensions you can only use two dimensions in the shortcut syntax. The following will do exactly the same but will work:
I think the reason is that the actual type of the other arrays can no longer be determined. The first two dimension types can be read from the reference type, but after that it's not possible to see if it should be Object, String or anything else.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Miran Cvenkel
Ranch Hand

Joined: Nov 23, 2010
Posts: 147
Thanks.

Do you see here, why test is lenght 2 which I think it should be 1
and filter length is 9 which is what it what I want ?

Miran Cvenkel
Ranch Hand

Joined: Nov 23, 2010
Posts: 147
figured out, instead of:

it should be


I don't know why it was all the time giving me syntax error before, on that.
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19692
    
  20

The elements of tests:
0: {"type","s"}
1: {"nomenclature","s"}

The elements of filter:
0: {"Data",new Object[][]{}}
1: {"Table",new Object[][]{}}
2: {"Information",new Object[][]{}}
3: {"Group",test}
4: {"Group",new String[][]{{"type"}, {"language"}}}
5: {"Group",new String[][]{{"type"}, {"dictionary"}}}
6: {"Element",new String[][]{{"name", "code"},new String[]{"value", "tag00061"}}}
7: {"AttList",new String[][]{}}
8: {"Att",new String[][]{{"name"}, {"label"}}}
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: multidim array initialize