Results 1 to 3 of 3

Thread: 2 dimensional array size

  1. #1

    Thread Starter
    Hyperactive Member Sneeden's Avatar
    Join Date
    Oct 2001
    Location
    Sneedville
    Posts
    258

    2 dimensional array size

    How do you get the size of each dimension?

  2. #2
    Dazed Member
    Join Date
    Oct 1999
    Location
    Ridgefield Park, NJ
    Posts
    3,418
    Hummm maybe like this?

    int[][] i = new int[4][6];
    int len = i.length;

    System.out.println("First dimension " + len);

    for(int k = 0; k < len; ++k){
    System.out.println("Second dimension" + i[k].length);
    }

  3. #3

    Thread Starter
    Hyperactive Member Sneeden's Avatar
    Join Date
    Oct 2001
    Location
    Sneedville
    Posts
    258
    Yes, thank you. I don't know why I didn't try that!


    sneed

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width