my dog learned polymorphism*
The moose likes Beginning Java and the fly likes How do u get the length of 2 dimensional array? 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 "How do u get the length of 2 dimensional array?" Watch "How do u get the length of 2 dimensional array?" New topic
Author

How do u get the length of 2 dimensional array?

Ravi Sathish
Ranch Hand

Joined: Feb 26, 2002
Posts: 131
Hi once again
How can I get the length of 2 dimensional array in a method?
to make myself clear:
main()
{
compute(emp);//method call
}
int[][] compute(int emp1[][])
{
int result =emp1[][].length;
// or how?
}
please help?
Michael Morris
Ranch Hand

Joined: Jan 30, 2002
Posts: 3451
Hi Ravi,
Try running this and you should fully understand how it works:

Just try to think of a multidimensional array as being an array of arrays.
Hope this helps,
Michael Morris
[ February 07, 2003: Message edited by: Michael Morris ]
[ February 07, 2003: Message edited by: Michael Morris ]

Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius - and a lot of courage - to move in the opposite direction. - Ernst F. Schumacher
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How do u get the length of 2 dimensional array?
 
Similar Threads
Two-dimensional array lengths????
Array Width
Array dimension - pl explain
Enhansed For Loop Please explain me
Multi-d array