How to retrieve elements from a Arraylist in another class..
Joined: May 24, 2004
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??
Joined: Mar 23, 2004
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 -