I believe that object reference variables must be at least 32 bit, but on a 64 bit implementation, an object reference variable
could be 64 bit. The implies that on a 32 bit implementation of
Java, there would be a limit of two-to-the-32nd-power (about 8 billion) number of objects, yet in an implementation of Java that uses 64-bits for object reference variables, the limit of the number of active objects is the astronomical number of 2-to-the-64th-power (18,446,744,074,000,000,000) active objects.
Also, in Java, an int is a signed integer with 32 bits of precision, but on a 64-bit implementation, an int can be implemented as a 64 bit register or memory location with the upper 32-bits being unused.
So why waste the space? Why use 64-bits when the upper 32-bits can't be used. The answer is that It could be faster to use the naturual word-size of 64 bits on a 64 bit processor.
In C and C++, both the actual size and the usable range of an int could vary. In C/C++ the only guarantee was that a short was no bigger than an int, and an int was no bigger than a long.in one operation.
In Java, however, with an int., the range must be the same. From negative 2 to the 31st power to positive two to the 31st power. So, in Java, the range is always the same regardless of the number of bits that the processor can process
There is no ]
sizeof operator in Java. But the useable size is
always the same:
1. byte 8-bits
2. short 16-bits
3. int 32-bits
4. long 64-bits