This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes Araylist of objects Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Araylist of objects" Watch "Araylist of objects" New topic
Author

Araylist of objects

ichabod
Greenhorn

Joined: Nov 17, 2001
Posts: 2
I am implementing an ArrayList of objects which are of type StudentInfo for this course registration system I am making. The class StudentInfo contains many variables. I want to do a few things to the ArrayList. The first is search the ArrayList's Objects for a particular field like SocialSecurityNumber. Secondly, I want to be able to access the variables within an object as well as send a copy of the object over a socket connection. I have seen implementations of casting the list into an array which has type Object, but I can not access any of the methods in StudentInfo objects through that. I am really confused, if anyone could help I would appreciate it alot.
Bosun Bello
Ranch Hand

Joined: Nov 06, 2000
Posts: 1510
You will have to cast the arraylist element you retrieve to it's appropriate type, in this case, studentInfo, then use that reference to access the SSN vsriable, or access the method that will get you the SSN variable.


------------------
Bosun
SCJP for the Java� 2 Platform


Bosun (SCJP, SCWCD)
So much trouble in the world -- Bob Marley
Marilyn de Queiroz
Sheriff

Joined: Jul 22, 2000
Posts: 9044
    
  10
ichabod,

Please do not cross-post. Many people read more than one forum, as you obviously did. I am closing this thread. please refer to http://www.javaranch.com/ubb/Forum1/HTML/002278.html for any further response/questions regarding this subject.

Also, please read http://www.javaranch.com/name.jsp and re-register. We would like you to continue to post here at JavaRanch.

JavaBeginnersFaq
"Yesterday is history, tomorrow is a mystery, and today is a gift; that's why they call it the present." Eleanor Roosevelt
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Araylist of objects
 
Similar Threads
java code and SAX
uploading data into JTable
Arraylist with objects
uploading data into JTable
Copying objects from one Arraylist to another Arraylist