This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes returning an array... Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Beginning Java
Reply Bookmark "returning an array..." Watch "returning an array..." New topic
Author

returning an array...

Brandi Love
Ranch Hand

Joined: Sep 19, 2003
Posts: 133
Can you return an array from a member method to the main method? If so, how would one go about doing it?
[ December 03, 2003: Message edited by: Brandi Love ]
Karthikeyan Rajendraprasad
Ranch Hand

Joined: Apr 16, 2003
Posts: 70
say you are having an method that returns a String array it should be like
private String[] returnArray()
{
String strArray[];
......
return strArray;
}


Karthikeyan<br />SCJP 1.4, SCWCD.
Brandi Love
Ranch Hand

Joined: Sep 19, 2003
Posts: 133
ahh I see. I was trying to do this for a program and I was declaring the method like this: public static passArray. I just wasn't putting the brackets it. Thank you very much!
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: returning an array...
 
Similar Threads
MAIN method
length Vs length()
Clarification for such a method
for loop construct with array
array size