This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes 2 dimensional array problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "2 dimensional array problem" Watch "2 dimensional array problem" New topic
Author

2 dimensional array problem

catherine matthews
Ranch Hand

Joined: Jan 22, 2006
Posts: 78
hi...
i have 2 different array declared like this
1. int [][] arr1= new int kk[8][3]
2. int [][] arr2 = new int kk[10][2]

i need to compare....
if (arr[k][2]==arr2[k][0])
{
System.out.println(arr2[k][1]);
}
how do i manage the iterations for k? the array sizes are different.....
please help....
[ June 15, 2006: Message edited by: catherine matthews ]
Keith Lynn
Ranch Hand

Joined: Feb 07, 2005
Posts: 2367
Remember that in Java, a 2 D array is just an array of arrays.

You can use a simple counter variable for each dimension.
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 37933
    
  22
There are standard conventions for iterating through the whole of an array. You will doubtless find them in this part of the Java tutorial.

I trust you are looking at the Java tutorial and the API documentation whenever you go anywhere near a Java editor?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: 2 dimensional array problem
 
Similar Threads
Arrays doubt
array
Java Inquisition Question
Output Not understand!!!
Printing in Array in Ascending order