Here what I need to do is to get all the reference variables pointing an object in java.
class Dummy{
public static void main(String[] args){
Object object = new Object();
Object object1 = object;
Object object2 = object;
Object object3 = object;
Object object4 = object;
object3 = null;
}
}
In this example I have created one object of Object class and five reference variables and assigned the same object to all the reference variables. Finally I set object3 to null. Now what I need is to check the name and total reference variables pointing an object.