Answer to Question #550 in Java | JSP | JSF for Matt

Question #550
Is there a collection data structure that I can use to hold and manipulate different types of objects (i.e. Vector)? I have been trying an Object array, however, it is extremely limited and doesn't seem to work right.
1
Expert's answer
2010-08-09T10:55:53-0400
You can not use a vector or an array of objects of different types. It's possible only if they inherited from one class, and need to store an array or vector of objects of this class. So using an array or vector of objects - the only possible solution if you do not know what will be in this array. Try to build your code in different way if this solution doesn't fit .

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS