In the book of P. Nouton, G. Shildt "Java 2. The most complete guide" says the following about the size of data types:
The width (or the number of bits allocated for storing values) of an integer type cannot be thought of as the amount of memory it occupies, but rather, as the behavior that it defines for variables and expressions of this type. The Java runtime is free to use whatever size it wants, while the types behave according to their declaration. There is at least one implementation of the execution environment that stores the
shortnumbers as 32-bit (not 8-bit and 16-bit) values to improve efficiency, because this value expresses the word size of most computers currently used.
Elsewhere in this book it says:
It may seem that using
bytesaves memory, but there is no guarantee that Java will not internally somehow extend these types to
int. Remember that type determines behavior, not size. (The only exception is arrays, where the type
byteguarantees the use of only one byte per array element, while
shortwill take two bytes and
int- four bytes).
In connection with the above, I had a question: what is meant by the word behavior of variables of integer type and is it true that for variables not declared as arrays, the size is not defined?