aspose file tools*
The moose likes Beginning Java and the fly likes Requesting help with solving a problem. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Requesting help with solving a problem." Watch "Requesting help with solving a problem." New topic
Author

Requesting help with solving a problem.

Mack Grill
Greenhorn

Joined: Feb 27, 2012
Posts: 29

I'm trying to determine java expression evaluates the number of columns

Given array T below,
double[][] T = new double[3][5];

what Java expression evaluates the number of columns , and what would this expression return for T?
Steve Luke
Bartender

Joined: Jan 28, 2003
Posts: 4181
    
  21

Java doesn't really have two dimensional arrays. Rather, it has arrays of arrays. What that means is, if we assume you mean the first index is the 'number of rows' then the number of 'columns' (the second length of the inner array) can vary from row to row. A common approach to get 'the number of columns' would be to get the length of the array at T[0] (the length of the first array indexed in T).


Mack Grill wrote:
...and what would this expression return for T?


What does it give you when you run it?


Steve
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Requesting help with solving a problem.