Using an Array from main in another class

C

charlene.camp

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?
 
R

Roedy Green

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.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,754
Messages
2,569,527
Members
44,998
Latest member
MarissaEub

Latest Threads

Top