There is a lot of discussions on this topic over the internet. Some of the people says both are same and some of other says both are different. Here I am planning to share my overall view on this topic. As per my knowledge both are looks same but different. Here are the some useful points:
- Instance is Logical but object is Physical means occupies some memory.
- We can create an instance for abstract class as well as for interface, but we cannot create an object for those.
- Object is instance of class and instance means representative of class i.e object.
- Instance refers to Reference of an object.
- Object is actually pointing to memory address of that instance.
- You can’t pass instance over the layers but you can pass the object over the layers
- You can’t store an instance but you can store an object
- A single object can have more than one instance.
- Instance will have the both class definition and the object definition where as in object it will have only the object definition.
Syntax of Object:
classname var=new classname();
But for instance creation it returns only a pointer refering to an object, syntax is :
classname varname;
Other Useful Links:
Difference between Abstract Class and Interface
What are the differences between EAR, JAR and WAR file?
Differences between callable statements, prepare statements, createstatements
hi
mallik,
this post is really good u r ideas of explanation is good
it helps me a lot to understand the difference between intance and object
regards,
gopi
Thanks dude,
Thank you very much
oh!!!
Mallik…
Good ur ex-poser abt differences….
Thanks Atavulla
Thanks dear
Its really good explanations.Thanks again
You are welcome subhranshu… 🙂 Thanks for visiting my site !!! Keep posted your suggestions
very good explanation
Very Clear……………
Thank You…
Thank you for your comments
it was a good explanation.
Thanks Rohit
many times i went and found the difference between the object and instance but no result .
@malik -no confusion now .Instance is the reference variable to hold the reference id of object.
very good explanation
thanks
Thank you for your comments Rohith… keep visit this blog for updates
very nice explanation….
very helpful
Thank you Varsha… Keep visiting the site.
Hi,Malik
its good but little bit confuse.if you give one example of this it is more understandable .
A single object can have more than one instance.how?
instance means allocating the memory space by the jvm and object means initializing the variables inside that instance. is it correct or not?