We all know that the Java programming language is a purely object language. All entities with which we have to deal with and perform any manipulations are objects (with the exception of primitives), including arrays. That is, if to speak absolutely simple words, then any array is specific object in memory. Java is a strongly typed language. Although the gradation into languages with weak and strong data typing is very conditional, but Java, one way or another, is more relevant to languages with strong typing. This leads us to the fact that all data has its fixed type (or class, if we speak in terms of OOP). Here is the whole snag! I always wanted to know how arrays are described, like some abstract entities, on the physical level. I understand that it is impossible to find a ready-made class in which the structure of arrays would be described, for the simple reason that this entity is one of the fundamental (as well as primivnyh data types) and its implementation is hidden somewhere on the JVM level or in what somewhere else.
Let's look at a trivial example. We know that the size of any array is fixed and is determined at the stage of creating the array itself. Array size information is stored in an integer variable with the same name length. Immediately a question arises regarding this field. Where did it come from? Where can I trace all this internal logic (if I may say so)? We go further. We created an array in memory, while immediately specifying its size. The size of the array corresponds to the number of similar elements that can be stored in this array. And here again the question. By what logic does JVM determine the number of elements we need? More precisely, not quite. It’s clear that we ourselves specify the size of the array, but doesn’t the number of fields for a single data type have to be fixed ?! Is there any code (even pseudocode) that could shed some light on this question?
