- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Get array upperbound in Java Multidimensional Arrays
In order to get the array upperbound of a multidimensional array, we use the length() method. For a 2D array, the length() method returns the number of rows. We can access the number of columns using the array_name[0].length method.
Let us see a program to get the array upperbound in Java Multidimensional arrays
Example
public class Example { public static void main(String args[]) { String[][] str = new String[5][10]; System.out.println("1st dimension : " + str.length); // displays the number of rows System.out.println("2nd dimension : " + str[0].length); // displays the number of columns } }
Output
1st dimension : 5 2nd dimension : 10
- Related Articles
- Multidimensional array in Java
- Get Upperbound and Lowerbound of a three-dimensional array in C#
- Get the Outer product of two multidimensional arrays in Python
- Multidimensional arrays in PHP
- Multidimensional Arrays in C
- Multidimensional Arrays in C / C++
- What is a Multidimensional array in Java?
- Initialization of a multidimensional arrays in C/C++
- PHP Multidimensional Array.
- How to set multidimensional array into JTable with Java?
- Initialization of a multidimensional arrays in C/C++ Program
- Multidimensional Collections in Java
- Get the smallest array from an array of arrays in JavaScript
- MongoDB multidimensional array projection?
- Single dimensional array vs multidimensional array in JavaScript.

Advertisements