File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes arrays in java Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "arrays in java" Watch "arrays in java" New topic
Author

arrays in java

vijayapriya thirumurugan
Greenhorn

Joined: Apr 03, 2009
Posts: 16

hi,

i have two dimentional array. my problem is in that two dimentional array every element is of the structure (struct) form which can hold two fields one is integer data, another one is list of elements(array). so can you give me some example for array of structure(struct) and explain me.
Thank you so much in advance..
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
Has nothing to do with Programming Diversions. Moving to the Java In General Forum.

Eric
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 40052
    
  28
There is no such thing as a 2-D array in Java; there are only arrays of arrays.
There is no such things as a struct in Java, only classes enums and interfaces. Which language are you writing in?

You create a class which has the two ints in, let's call it OrderedPair. Then you declare and initialise an OrderedPair[][] array of arrays.
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 40052
    
  28
Sorry, I misread your original requirement. You want a NumberedList class with an int field and a List field. Then a NumberedList[][] array.

A number and a List sounds like a Mapping; looking at this interface and the remainder of that tutorial thread might suggest an alternative way to handle your data.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: arrays in java