 
  Data Structure Data Structure
 Networking Networking
 RDBMS RDBMS
 Operating System Operating System
 Java Java
 MS Excel MS Excel
 iOS iOS
 HTML HTML
 CSS CSS
 Android Android
 Python Python
 C Programming C Programming
 C++ C++
 C# C#
 MongoDB MongoDB
 MySQL MySQL
 Javascript Javascript
 PHP PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to get rows and columns of 2D array in Java?
Following example helps to determine the rows and columns of a two-dimensional array with the use of arrayname.length.
Example
Following example helps to determine the upper bound of a two dimensional array with the use of arrayname.length.
public class Main {    public static void main(String args[]) {       String[][] data = new String[2][5];       System.out.println("Dimension 1: " + data.length);       System.out.println("Dimension 2: " + data[0].length);    } }  Output
The above code sample will produce the following result.
Dimension 1: 2 Dimension 2: 5
Advertisements
 