• Post Reply Bookmark Topic Watch Topic
  • New Topic

Return Array - Help...  RSS feed

 
Carie Herrick
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Sheriff
Posts: 24217
38
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Carrie,

Welcome to JavaRanch!

It should just be

public static Group[] loadData()

Makes sense, right?
 
Carie Herrick
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!