java- can u make a return method for an array?

<p>I've tried and tried but can't seem to get it work. does anyone konw the code to do it? let's say the array is called classes[]</p>

<p>You mean return an array? Sure, since they are objects, you can just return them by reference.</p>

<p>You might want to change the name of the array...isn't classes a reserved word? I may be wrong, but I know class is a reserved word.</p>

<p>And like duality said, you can return them by reference.</p>

<p>If you want to get the array to display, you must print it using System.out.print or println.
Make a for loop first to and print out each index individually.</p>

<p>I'm a bit confused by your question. What exactly do you want to do? Return the elements of the array? Return the index of each element?</p>

<p>nvm got it all fixed.! turned out you only put the brackets in an array variable when you are creating that variable</p>