+ 1

Can an array have more then kind of object in it?

Can an array have multiple objects in it such int and string information?

21st Jun 2019, 11:31 AM
<htmlf>
<htmlf> - avatar
1 Respuesta
0
Here I created an array of Object class which is the superclass of every object in java so u can basically store any type of element in it. I never tried to store an user-defined class object in Object class array may be u have to typecast them while retrieving an element. https://code.sololearn.com/cM8nO4JoLOpV/?ref=app
21st Jun 2019, 12:01 PM
Yugabdh
Yugabdh - avatar