I have found a situation where I need a pointer like C++ but in JAVA. I'm going to explain the exactly situation so someone can help me:
I'm developing a videogame. In it, there are some chest which give you some items. The amount of items you have is saved in a general object which it's not important. The case is that I want to create just one generic chest object in which I can indicate to it which object is going to give to the player, and when you open it, then it will sum the quantity in the generic object. The problem is that I don't want to use a huge switch inside the chest object in where I check which kind of object is going to sum up. Instead of it, I want to give to the object a pointer to the Integer of the generic object to sum it easily.
Is this possible in JAVA? If not... any tip to do it in an easy way? Thanks!