This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
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


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
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: 38044
    
  22
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: 38044
    
  22
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.
 
 
subject: arrays in java
 
Similar Threads
Putting Multi Dimentional Array into a session in JSP
ExamLab Question
Need Expert Advice
Is this a correct array declaration? How?
array access