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 Create an array 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 "Create an array" Watch "Create an array" New topic
Author

Create an array

Milind Deodhar
Greenhorn

Joined: Oct 04, 2002
Posts: 9
hi,
I want to create an array like this
--Index, integer, and char
1. 12 A
2. 9 B

How can that be done in Java,
Thanks a lot.
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

Array[][] - Multidimensional Array. You will probably want to use an Object[][] type so you can store the different data types appropriatly. The index will be kept via the Array itself.


GenRocket - Experts at Building Test Data
Milind Deodhar
Greenhorn

Joined: Oct 04, 2002
Posts: 9
Thanks for the reply,
Suppose I have a 2 dimension array like this
int, int
How do I write the for loop to access this array.
Thanks
Milind.
Dirk Schreckmann
Sheriff

Joined: Dec 10, 2001
Posts: 7023
Milind D,
Welcome to JavaRanch!
We ain't got many rules 'round these parts, but we do got one. Please change your display name to comply with The JavaRanch Naming Policy.
Thanks Pardner! Hope to see you 'round the Ranch!


[How To Ask Good Questions] [JavaRanch FAQ Wiki] [JavaRanch Radio]
William Barnes
Ranch Hand

Joined: Mar 16, 2001
Posts: 984


Suppose I have a 2 dimension array like this
How do I write the for loop to access this array.

Dirk Schreckmann
Sheriff

Joined: Dec 10, 2001
Posts: 7023
Where
MAX_I = arrayVar.length;
and
MAX_J = array[i].length;
William Barnes
Ranch Hand

Joined: Mar 16, 2001
Posts: 984

int MAX_I = ...
int MAX_J = ...
int[][] arrayVar = new int[ MAX_I ][ MAX_J ] ;
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Create an array
 
Similar Threads
removing duplicates in array ...?????
Marcus exam 3 # 26
array of Structures in java ?
Prototype Pattern?
Retriving jTextfield value from an other java file