Differences between Object and Instance


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

19 thoughts on “Differences between Object and Instance

  1. gopi May 19, 2010 / 12:23 pm

    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

    • mallikarjungunda May 19, 2010 / 12:25 pm

      Thanks dude,

      Thank you very much

  2. MM.Atavulla May 19, 2010 / 12:45 pm

    oh!!!

    Mallik…

    Good ur ex-poser abt differences….

    • mallikarjungunda May 19, 2010 / 1:24 pm

      Thanks Atavulla

  3. Subhranshu August 29, 2013 / 11:03 am

    Thanks dear
    Its really good explanations.Thanks again

  4. Subhranshu August 29, 2013 / 11:04 am

    Subhranshu :
    Thanks dear
    Its really a good explanation
    .Thanks again

    • Mallik August 29, 2013 / 6:07 pm

      You are welcome subhranshu… 🙂 Thanks for visiting my site !!! Keep posted your suggestions

  5. Piyush sharma September 6, 2013 / 6:03 pm

    very good explanation

  6. dasariuma48 January 2, 2014 / 6:59 am

    Very Clear……………
    Thank You…

    • Mallik January 6, 2014 / 4:53 pm

      Thank you for your comments

  7. Rohit January 28, 2014 / 7:20 am

    it was a good explanation.

  8. Rohit Dabas March 14, 2014 / 7:54 am

    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

    • Mallik March 16, 2014 / 10:32 pm

      Thank you for your comments Rohith… keep visit this blog for updates

  9. varsha kotahri August 22, 2014 / 3:51 am

    very nice explanation….
    very helpful

    • Mallik August 26, 2014 / 9:29 pm

      Thank you Varsha… Keep visiting the site.

  10. arun July 27, 2015 / 1:10 pm

    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?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.