The program I am creating a program in which a method is using A LOT of different arrays! For me, it is rather difficult to keep track of all them. So, why not combine them into a multi-dimensional array? My problem is how can I combine a String[] array with a Object[] array?
Can someone help me with this?
If you declare an array of a particular type, all subtypes can be stored in the array. E.g.
can now store any object, Strings, Dates, JButtons etc. However, this can be dangerous when you are retrieving the items from the array. You have to ensure that you interpret them correctly. The compiler would not be able to warn you if you store the wrong type of object in there.
A better approach might be to create your own collection object that stores all the various items in a way that is type safe.