Fork me on GitHub
Ben Sless16:08:17

I'm trying to understand the difference, if there is one, between an array of objects and named classes, i.e. Object[] vs. MyClass[], in terms of memory layout and performance differences. From what I read, arrays of non primitive types hold only references


I believe the difference only exists in the type system (and controls polymorphism around updates and access to the contained objects).


if you make an array of MyClass[] there will be runtime verification of the types of elements


even if you turn it into Object[] in the type system


Yeah, one of the few runtime type checks that is built into the JVM, right?