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

Use an ArrayList (this is dynamic whereas an array is fixed length).

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.