I would like to know the relationship of regular Object array used for refiable object like String vs Object array used for non-refiable such as generics.
When objects reference variable points to the String array, it can ONLY store String value into the array. This is for regular array.
Now, List<String> ... arrayOfListString is non-refiable. It is varargs argument in the method MyArray.
Java will turn List<String> ... arrayOfListString into Object  array.
So I try to play around with line 3 and line 4. See below.
My question is line 2 where Object objects is pointing to arryOfListString which is an array of List<String> of type String.
On line 4, why can objects point to different type of ArrayList of type Integer? Why not ArrayList of type String only?
Here's a link to a blog post I just tracked down which explains why generics and arrays don't work together in Java: Why is Generic Array Creation not Allowed in Java?. (In the example you posted, you have an array of List objects and not an array of List<anything> objects.
Of course, I found a very beautiful couch. Definitely. And this tiny ad:
Devious Experiments for a Truly Passive Greenhouse!