A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://www.tutorialspoint.com/javaexamples/arrays_upperbound.htm below:

How to determine the upper bound of a two dimensional array in Java

How to determine the upper bound of a two dimensional array in Java Problem Description

How to determine the upper bound of a two dimensional array?

Solution

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);
   }
}

The above code sample will produce the following result.

Dimension 1: 2
Dimension 2: 5

java_arrays.htm


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4