aspose file tools*
The moose likes Beginning Java and the fly likes Stroring my own objects into Javas LinkedList? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Stroring my own objects into Javas LinkedList?" Watch "Stroring my own objects into Javas LinkedList?" New topic
Author

Stroring my own objects into Javas LinkedList?

Alex Almani
Greenhorn

Joined: Jan 08, 2004
Posts: 6
I was wondering how I store my own object into a LinkedList? For example if I have an object House defined I want to make a LinkedList of houses.

I tried this:
LinkedList ll=new LinkedList()
House h1=new House();
ll.add(h1);

but it did now work.. any suggestions?
marc weber
Sheriff

Joined: Aug 31, 2004
Posts: 11343

When you say it didn't work, how do you know? Did you receive compilation errors? The only thing I see wrong with the snippet you posted is a semicolon missing after the first line.

Other than that, my best guess is that you forgot to import java.util.*.


[ October 07, 2004: Message edited by: marc weber ]

"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer
sscce.org
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Stroring my own objects into Javas LinkedList?