• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Requesting help with solving a problem.

 
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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?
 
Bartender
Posts: 4179
22
IntelliJ IDE Python Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?
 
reply
    Bookmark Topic Watch Topic
  • New Topic