This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
I'm a little bit confused. Is this a hypothetical question, or do you have a concrete example that you could share?
You could store objects in a Collection (such as a LinkedList, which does not use an array to store the objects) and then iterate over the collection. So the answer is Yes.
But if you are asking whether Java has an accessible "Object Registry" listing all objects that have been created, the answer is No. If you create an object, in order to get the object you have to maintain a reference somewhere:
- as a member variable in another object - in an array - in a Collection
Piscis Babelis est parvus, flavus, et hiridicus, et est probabiliter insolitissima raritas in toto mundo.