Q:

Java unknown number of class instances

I am building a game where there is a ship that fires missiles(there is a Player class for the ship and a Missile class for the missiles), but I don´t know exactly how many missiles will be shot throughout the whole game. That means I cannot just Missile one = new Missile(...), if so I would have to declare a billion of missiles. My question: Is there a simple way, in Java, of creating a dynamic number of object instances which are not stored in variables for each?

A:

Also worth noting that while I know little about your game I somehow imagine individual missiles might be quite short lived objects and you might just want to discard them throughout the game.
The ever present garbage collector will deal with all your spent ordnance.

