944,113 Members | Top Members by Rank

Ad:
  • Java Discussion Thread
  • Unsolved
  • Views: 667
  • Java RSS
Oct 25th, 2007
0

Storing Objects

Expand Post »
Hi, I have a project on which I am working.
I have two classes. A box Class which is of an undefined capacity and is only defined when an instance of the box class is made and I have an item class of which instances of it must be stored in the box. How might I represent this. Particularly When I create an Item how do I store it in the box as I may have to make more than one item per box created. I should also be able to subtract item from the box.

My attempt had me make an item array in the box class does that seem wrong. It does to me.

Any help would be appreciated.


Many thanks
Similar Threads
Reputation Points: 14
Solved Threads: 0
Junior Poster in Training
Grub is offline Offline
60 posts
since Oct 2007
Oct 25th, 2007
0

Re: Storing Objects

Use an ArrayList (this is dynamic whereas an array is fixed length).
Moderator
Reputation Points: 1471
Solved Threads: 490
Industrious Poster
masijade is offline Offline
4,043 posts
since Feb 2006

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Java Forum Timeline: URLConnection problem
Next Thread in Java Forum Timeline: exe creation and its usage without jdk/jre





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC