Using an Array from main in another class

Discussion in 'Java' started by charlene.camp@gmail.com, Feb 6, 2006.

  1. Guest

    I want to create an array in my main and put a bunch of different ints
    in it. Then I want to make a method in a different class and use my
    array in it. How do I call the array from the main class and put it
    into the class I want it?
     
    , Feb 6, 2006
    #1
    1. Advertising

  2. Roedy Green Guest

    On 5 Feb 2006 19:49:24 -0800, ""
    <> wrote, quoted or indirectly quoted someone
    who said :

    >How do I call the array from the main class and put it
    >into the class I want it?


    You pass it as a parameter to a method of that other class.. If you
    want to pass it to some other static method of the same class, you
    could also put a reference to it in a static variable.
    --
    Canadian Mind Products, Roedy Green.
    http://mindprod.com Java custom programming, consulting and coaching.
     
    Roedy Green, Feb 6, 2006
    #2
    1. Advertising

  3. char Guest

    Thank you so much!
     
    char, Feb 7, 2006
    #3
    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. John M
    Replies:
    1
    Views:
    1,310
    Kumar Reddi
    May 29, 2005
  2. cyril
    Replies:
    2
    Views:
    3,951
    cyril
    Aug 25, 2004
  3. Meidan
    Replies:
    14
    Views:
    616
    Meidan
    Dec 15, 2005
  4. Hal Styli
    Replies:
    14
    Views:
    1,716
    Old Wolf
    Jan 20, 2004
  5. Frederick Ding

    int main() or int main(void)?

    Frederick Ding, Dec 3, 2005, in forum: C Programming
    Replies:
    10
    Views:
    675
Loading...

Share This Page