+ 1

Can we hold heterogeneous data in one array in java.

Can we hold heterogeneous data in one array in java.

18th Nov 2021, 12:29 PM
swamy
swamy - avatar
3 Answers
+ 5
Java array can store only same type of data.
18th Nov 2021, 12:30 PM
A͢J
A͢J - avatar
+ 4
Not heterogeneous but if you're okay with reference types then you can use an Object array. https://code.sololearn.com/cbEyJo66ftpt/?ref=app
18th Nov 2021, 1:29 PM
Anannya
+ 3
Swamy, Please avoid copying the question into the tags. https://code.sololearn.com/W3uiji9X28C1/?ref=app
18th Nov 2021, 12:51 PM
Ipang