Results 1 to 6 of 6
  1. #1
    shavindra is offline Member
    Join Date
    Dec 2012
    Posts
    5
    Rep Power
    0

    Question Multidimensional arrys

    guys I'm new to java and I'm just wondering what the [3] means in int [][][] x=new int [3][][];
    [/B]
    Please guys help me with this...
    Last edited by shavindra; 12-13-2012 at 01:12 PM.

  2. #2
    DarrylBurke's Avatar
    DarrylBurke is online now Forum Police
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,404
    Rep Power
    20

    Default Re: Multidimensional arrys

    Java doesn't really have multidimensional arrays, even though we may speak of them as such. Java has arrays; the type contained in an array may be of any reference or primitive type -- even an array type.

    So, int[] is an array of int.
    int[][] is an array of int[].
    int[][][] is an array of int[][].

    Do you understand what int[] a = new int[3]; would mean?

    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

  3. #3
    shavindra is offline Member
    Join Date
    Dec 2012
    Posts
    5
    Rep Power
    0

    Default Re: Multidimensional arrys

    I think that this array has 3 values.
    pls correct me if I'm wrong. I dont no about 3 dimensional arrays and when it comes to this example "int [][][] x=new int [3][][];", what do this means by 3 in this situation ?
    Last edited by shavindra; 12-13-2012 at 02:07 PM.

  4. #4
    DarrylBurke's Avatar
    DarrylBurke is online now Forum Police
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,404
    Rep Power
    20

    Default Re: Multidimensional arrys

    Answer my question first:
    Do you understand what int[] a = new int[3]; would mean?
    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

  5. #5
    shavindra is offline Member
    Join Date
    Dec 2012
    Posts
    5
    Rep Power
    0

    Default Re: Multidimensional arrys

    Variable a has 3 values

  6. #6
    DarrylBurke's Avatar
    DarrylBurke is online now Forum Police
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,404
    Rep Power
    20

    Default Re: Multidimensional arrys

    Quote Originally Posted by shavindra View Post
    Variable a has 3 values
    Wrong. Variable a has just one value. There's no way a single Java variable can hold more than one value.

    Go through Arrays (The Java™ Tutorials > Learning the Java Language > Language Basics) and try again.

    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

Similar Threads

  1. Multidimensional Array
    By TyCox94 in forum New To Java
    Replies: 11
    Last Post: 09-25-2011, 11:00 PM
  2. Help in Multidimensional Arrays :(
    By sexy_programmer in forum New To Java
    Replies: 17
    Last Post: 06-29-2011, 04:54 PM
  3. Multidimensional Array help
    By Gaebril in forum New To Java
    Replies: 1
    Last Post: 04-09-2011, 08:36 PM
  4. Multidimensional Arrays
    By holytanx in forum New To Java
    Replies: 1
    Last Post: 08-05-2010, 10:28 PM
  5. Multidimensional arrays
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 11-05-2007, 05:07 PM

Posting Permissions

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