aspose file tools
The moose likes Beginning Java and the fly likes How  to retrieve elements from a Arraylist in another class.. Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Reply Bookmark "How  to retrieve elements from a Arraylist in another class.." Watch "How  to retrieve elements from a Arraylist in another class.." New topic
Author

How to retrieve elements from a Arraylist in another class..

Leeee Ming
Greenhorn

Joined: May 24, 2004
Posts: 12
How to retrieve elements from a Arraylist in another class..???

I have 2 classes SMS class and a Message class...

my SMS class is used to store text messages in an Arraylist...

While my Message class is used to retrieve messages from the Arraylist found in my SMS class..

How do i retrieve from an arraylist found in another class??

Thanks
C. Nimo
Ranch Hand

Joined: Mar 23, 2004
Posts: 82
ola.
the answer depends on how you defined the ArrayList in your SMS class.
if the Message class may access it directly - (i.e. - it is public, or you have your classes in the same package and declared it with package access) -you could just use it straight away. something like:

(This is inside the Message class)


however - this is not a good solution in terms of software engineering.
what you probably want to do is have methods in your SMS class for retrieving / deleting messages -

was that any help?
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: How to retrieve elements from a Arraylist in another class..
 
Similar Threads
Need help with using arraylist
how to find correct email and undeliverable email in javamail
How to capture the location?
Populating a selectbox a clean solution
WMA MIDlets, how do you receive sms without a port no.