java

Ben Sless 2021-08-05T16:27:17.002500Z

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

seancorfield 2021-08-05T17:34:05.004300Z

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

emccue 2021-08-05T18:13:24.005100Z

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

emccue 2021-08-05T18:13:38.005400Z

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

seancorfield 2021-08-05T18:46:33.005900Z

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