Ask your own question, for FREE!
Computer Science 12 Online
OpenStudy (mimi_x3):

I have a linkedlist in java

OpenStudy (mimi_x3):

in one of the last sub class i have it as private but then i have a public function for the linkedlist how do i return everything from this linkedlist from the main file

OpenStudy (mimi_x3):

private LinkedList<Crap> craps; public LinkedList<Crap> getCrapList() { return craps; }

OpenStudy (e.mccormick):

Yes, that is basically what getters let you do. Return information even though it is private. I am not sure where your problem is.

OpenStudy (mimi_x3):

I have a linkedlist of rooms in a hotel class..how do i return all of the rooms within the hotel

OpenStudy (mimi_x3):

I have a class hotel too

OpenStudy (mimi_x3):

In java, i seem to be able to only return one element i.e one room

OpenStudy (mimi_x3):

i want a list of rooms

OpenStudy (e.mccormick):

Then you need a getter that does so. Probably can use the toArray() method.

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Latest Questions
Arriyanalol: i need help
1 day ago 7 Replies 1 Medal
Arriyanalol: CONGRATS to me
2 days ago 8 Replies 2 Medals
Legomaster346: What colleges are good that are near Arab Alabama?
1 week ago 5 Replies 0 Medals
Arriyanalol: i need help
1 week ago 6 Replies 2 Medals
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!