What is difference between the following in java :
Object
Reference ID
Reference Variable
When I see sta
Car c=new Car();
Object is nothing it is just a buffer or memory in heap where non static data members gets the memory.
Reference ID is generated by new operator in the stack and it is a memory location which contains the memory location of an object in hashcode form. Reference ID is the only way to reach the object. Reference ID is generated because there is a rule in java that memory allocated at run time does not have any name and we all know that objects are created at run time so they also have no name and we need a unique ID to perform operation on that object that's why there is a unique Reference ID in java for each object.
In above example c is a reference variable which store the reference ID.