Results 1 to 3 of 3
  1. #1
    Aidoru is offline Member
    Join Date
    Dec 2010
    Posts
    2
    Rep Power
    0

    Default initialize multidimensional array

    Hello,
    I've a question about multidimensional array:
    I think it's impossibile to initialize a multidimensional array as follow:
    int[] K = {{1,2,3,4,5}, {6,7,8,9,10}};
    because i need to specify that it's a matrix, and so:
    int[] []K = {{1,2,3,4,5}, {6,7,8,9,10}};

    Am I right?
    Thank you

  2. #2
    Zack's Avatar
    Zack is offline Senior Member
    Join Date
    Jun 2010
    Location
    Destiny Islands
    Posts
    692
    Rep Power
    4

    Default

    Why not give it a shot and see what happens?

  3. #3
    Aidoru is offline Member
    Join Date
    Dec 2010
    Posts
    2
    Rep Power
    0

    Default

    I did, and it tell me an error.... but i would like to be sure that when i initizalize a matrix i need the "[][]"... I think that i'm confused: don't remember if was in c++ where you can pass matrix to a method without tell the numeber of row, i can tell only number of column...
    Thank you anyway

Similar Threads

  1. Retrieve Multidimensional Array ??
    By oneofthelions in forum New To Java
    Replies: 3
    Last Post: 12-12-2009, 07:24 AM
  2. Navigate through a multidimensional array
    By VinTiger in forum New To Java
    Replies: 4
    Last Post: 05-05-2009, 07:16 PM
  3. [SOLVED] Multidimensional array
    By Torgero in forum New To Java
    Replies: 20
    Last Post: 03-22-2009, 11:36 PM
  4. How to initialize an Array
    By Java Tip in forum java.lang
    Replies: 0
    Last Post: 04-14-2008, 08:47 PM
  5. Initialize array at runtime
    By javaplus in forum Java Tip
    Replies: 2
    Last Post: 11-09-2007, 11:44 AM

Posting Permissions

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