initializing an array

Discussion in 'Java' started by newby1, Jul 3, 2004.

  1. newby1

    newby1 Guest

    I have a program I must write which includes several items. I am using
    an array and am having trouble initializing the array. I have a 2
    dimensional array with 50 placeholders. How do I initialize without
    listing all 50 spots?
    Thanks,
    Newby
     
    newby1, Jul 3, 2004
    #1
    1. Advertising

  2. newby1

    Roedy Green Guest

    On 2 Jul 2004 20:45:53 -0700, (newby1)
    wrote or quoted :

    >I have a program I must write which includes several items. I am using
    >an array and am having trouble initializing the array. I have a 2
    >dimensional array with 50 placeholders. How do I initialize without
    >listing all 50 spots?


    see http://mindprod.com/jgloss/gotchas.html#MATRIX

    --
    Canadian Mind Products, Roedy Green.
    Coaching, problem solving, economical contract programming.
    See http://mindprod.com/jgloss/jgloss.html for The Java Glossary.
     
    Roedy Green, Jul 3, 2004
    #2
    1. Advertising

  3. newby1

    Sam Guest

    (newby1) wrote in message news:<>...
    > I have a program I must write which includes several items. I am using
    > an array and am having trouble initializing the array. I have a 2
    > dimensional array with 50 placeholders. How do I initialize without
    > listing all 50 spots?
    > Thanks,
    > Newby


    I guess you would need a nested loop for that.

    Sam90
     
    Sam, Jul 4, 2004
    #3
  4. newby1

    Hal Rosser Guest

    Arrays and loops go together like pb & J
    for 2 dimensional array : use nested for loops

    "newby1" <> wrote in message
    news:...
    > I have a program I must write which includes several items. I am using
    > an array and am having trouble initializing the array. I have a 2
    > dimensional array with 50 placeholders. How do I initialize without
    > listing all 50 spots?
    > Thanks,
    > Newby



    ---
    Outgoing mail is certified Virus Free.
    Checked by AVG anti-virus system (http://www.grisoft.com).
    Version: 6.0.712 / Virus Database: 468 - Release Date: 6/28/2004
     
    Hal Rosser, Jul 4, 2004
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    11
    Views:
    1,126
  2. J. Campbell
    Replies:
    4
    Views:
    8,443
    Gianni Mariani
    Jan 29, 2004
  3. Steven T. Hatton
    Replies:
    1
    Views:
    6,685
    Siemel Naran
    Apr 19, 2004
  4. Pedro Miguel Carvalho

    Problem initializing class with literal array!

    Pedro Miguel Carvalho, Oct 21, 2004, in forum: C++
    Replies:
    3
    Views:
    7,966
    Victor Bazarov
    Oct 21, 2004
  5. Neno
    Replies:
    2
    Views:
    3,261
Loading...

Share This Page