Monday, March 16, 2015

Two dimensional array in a java pgm



determine the upper bound of a two dimensional array
 
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);
   }
}

Result:

Dimension 1: 2
Dimension 2: 5

No comments:

Post a Comment