In general, as for as objects, java reclaims the memory occupied by the object whenever it is no longer needed. But at the same time we are using int, float and double data types, which are defined internally by the java language itself. What about the memory of that data type whenever it is no longer needed?
Please give me a reply…
Saravanan.P
Java removes any variables from memory as soon as those variables are no longer accessible. In other words, the built-in primitive datatypes consume no memory as soon as you leave the block they were declared in.
The memory usage of the different primitive datatypes are: