fork download
  1. import java.util.Arrays;
  2. class MultidimensionalArray {
  3. public static void main(String[] args) {
  4.  
  5. int[][] a = {
  6. {1, 2, 3},
  7. {4, 5, 6, 9},
  8. {7},
  9. };
  10.  
  11. System.out.println("Length of row 1: " + a[0].length);
  12. System.out.println("Length of row 2: " + a[1].length);
  13. System.out.println("Length of row 3: " + a[2].length);
  14. }
  15. }
Success #stdin #stdout 0.08s 27628KB
stdin
Standard input is empty
stdout
Length of row 1: 3
Length of row 2: 4
Length of row 3: 1