The whole array is referenced by using the name of the array without the []s
Welcome to the Java Programming Forums
The professional, friendly Java community. 21,500 members and growing!
The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.
>> REGISTER NOW TO START POSTING
Members have full access to the forums. Advertisements are removed for registered users.
The whole array is referenced by using the name of the array without the []s
If you don't understand my answer, don't ignore it, ask a question.
Meaning your method signature will need adjusting as well to specify the correct data type
Okay well I made my method a void, so it would not return anything. So my question if I don't return anything I will store the array in the main method for further use?
--- Update ---
I'm trying something right now.
Basically yes, although you need to edit your methods so you are working on the array you have passed to the method, not creating a new one and working on that as any data you create in a method will be destroyed when the method completes execution...
So what you want is: create your array in the main method, pass that array to your first method (can be a void method) make the necessary changes to THAT array, any changes to the array will reflect on the original one because it is a non-primitive data type, then back in your main method you pass the same array to the print method which is also void, and make sure that it's printing the correct array...
Rain_Maker (March 24th, 2013)
okay I was actually thinking about doing that. I'm going to try that.
Using a "global" for passing and returning values from methods is not the way to it.
Have the method return the array of Strings that it creates.
If you don't understand my answer, don't ignore it, ask a question.