4
As union
the ones I’m talking about are the same as C/C++. The goal of union
is to save memory using the same region of it to store different data at different times.
It’s like a hotel room. Different people live in it for periods of time that don’t overlap. These people never meet and usually know nothing about each other. By properly managing the shared time of the rooms (i.e., ensuring that different people are not assigned to a room at the same time), a reasonably small hotel can offer accommodation for a relatively large number of people.
Is it possible to replicate this behavior in Java? If so, how?
I have no idea how it would be possible to do something like this in Java, nor do I know if it even allows memory management, so thank you for any help.
This may help, but I’m not sure how effective it is: https://www.guj.com.br/t/resolvido-union-ou-similhante-em-java/81499/13
– NinjaTroll