• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

refrence,instance and object

 
Arun Maalik
Ranch Hand
Posts: 216
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear sir i often get confuse the diffrence between refrence,instance and object of a class so please specify the difrence between these things.


with regfard


Arun kumar maalik
 
Deepak Bala
Bartender
Posts: 6663
5
Firefox Browser Linux MyEclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

My name is not sir but i will reply

When a class is instantiated and loaded it becomes an object.

When you have many objects of the same type they can be called as instances of that object. They need not have the same data in them.

A reference is used to point to an object. This reference may also point to null which means that it points to nothing. A reference is a way by which you can access the contents of that object. If you try to execute methods or access variables of a reference that points to null, you get a NullPointerException.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic