What Is The Difference Between Reference, Instance And Object In Java?


9 Answers

Anonymous Profile
Anonymous answered
Object is an occupied memory for a class. Reference points to that memory and it has got a name (you can call it as a variable). For example,
A a = new A();
here when we write "new A();" some memory will be occupied in the system.
'a' is the reference(variable) which points to this memory and is used to access the data present in this memory.
Anonymous Profile
Anonymous answered
Refrence is a variable that points the objects. Object is the instance of the class that have some memory and instance is a variable & methods that object have.
Anonymous Profile
Anonymous answered
Object is just a memory allocated to the variables of class . But at particular time the values hold by variables is the instance of that object . A single object can have more than one instance.
Anonymous Profile
Anonymous answered
Object is a by default super class.....yes its a java class.
Instance and object are same.
Reference is like pointer to reffer an object
Bus b = new Bus();
here b ia an reference
ashwin pai Profile
ashwin pai answered
object has a memory allocated to it during its creation using the syntax
classname var=new classname();
But for instance creation it returns only a pointer refering to an object,syntax is
classname varname;
Rajat Dhande Profile
Rajat Dhande answered

Object is the instance of a class, which is concrete. From the above example, we can create instance of class Vehicle as given below

  Vehicle vehicleObject;

We can have different objects of the class Vehicle, for example we can have Vehicle objects with 2 tyres, 4tyres etc. Similarly different engine capacities as well.

for more visite in this site

Object is obtained when it has a life, means it has occupied some memory.
Reference points to the Object.
Instance is the copy of the Reference that points to object at a point of time.
rajesh tiwari Profile
rajesh tiwari answered
Reference means address of object or variable.  Object is instance of class and instance means representative of class i.e object.
Anonymous Profile
Anonymous answered
Object is a java class.
Instance is a variable that is a construction of that class.
Reference is what us old timers call a pointer to an instance.

Answer Question