| Author |
Return Array - Help...
|
Carie Herrick
Greenhorn
Joined: Sep 26, 2008
Posts: 16
|
|
I am at a total loss as to what I'm missing here. I've been asking the question, but nobody will tell me what the answer is, so I'm hoping I can get the answer here (and soon... ) I have a method loadData() that I need to return an array to my main() method. I need to figure out what type the return is so I can properly name it in my loadData() method. Here's a lowdown of what I have: public class myProject() { public static ??? loadData() - this is where I don't know what to use! { //here I have the data I'm loading and the last part of the load is to turn the data into an array, so here's my last line prior to return Group [] groups = {g1, g2, g3, g4, g5, g6}; return groups; } } HERE'S where I need to call the returned array in my project: public static void main(String[] args) { Group [] groups = loadData(); } Is this enough data for someone to tell me what I'm missing here? I know that the array works as I've been able to test. Thanks, Carie
|
 |
Ernest Friedman-Hill
author and iconoclast
Marshal
Joined: Jul 08, 2003
Posts: 24081
|
|
Hi Carrie, Welcome to JavaRanch! It should just be public static Group[] loadData() Makes sense, right?
|
[Jess in Action][AskingGoodQuestions]
|
 |
Carie Herrick
Greenhorn
Joined: Sep 26, 2008
Posts: 16
|
|
Thank you, thank you, thank you!!! I've been tearing my hair out for 2 days trying to figure it out. How simple was that!!?? Thanks again, Carie
|
 |
 |
|
|
subject: Return Array - Help...
|
|
|