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.
Expert's answer
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!


No comments. Be first!

Leave a comment

Ask Your question

New on Blog