In Java, I am working with arrays, and I have a query. I am aware that a Java array is a grouping of related data types, as demonstrated below:
int[] x = new int[]{1,2,3};
The declaration mentioned above can be interpreted as an integer array, which is a grouping of integer types.
Think about this
Object[] x = new Object[]{1,2,3,"srk"};
In this case, can I state that the aforementioned is an array made up of a variety of different data kinds, or is it an object array made up of a variety of different data types, i.e. objects?
I'm confused and dubious about this. Is it feasible to design an array or other collection in Java that can hold various data types?