Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Stroring my own objects into Javas LinkedList?

 
Alex Almani
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 11343
Java Mac Safari
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic