• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Difference between an Object and Instance.

 
Arav Kumar
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi to all Ranchers,

Please explain what is the difference between an Object and Instance, If they are same then why we have different terminologies.

Regards
Arav Kumar.
 
Campbell Ritchie
Sheriff
Posts: 48652
56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please do a search; that question is asked frequently.

An "instance" should really be "an instance of class Foo" which means an object whose type is "Foo". So the two are very similar. An "object" could have any type.
 
Rob Spoor
Sheriff
Pie
Posts: 20512
54
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Also, an Object (with capital O) is an instance of class java.lang.Object.
 
Campbell Ritchie
Sheriff
Posts: 48652
56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
But all objects are Objects, not like in Eiffel where all objects are Generals and Anys.
 
Embla Tingeling
Ranch Hand
Posts: 237
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Arav Kumar wrote:Please explain what is the difference between an Object and Instance, If they are same then why we have different terminologies.


An object is a class instance or an array.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic