Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Refrence variable or object

 
Arun Maalik
Ranch Hand
Posts: 216
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear sir in the following code like
Button b=new Button();
what can we say b as b is a rfrence variable or b is an object of class Button. and if it is a refrence variable then where is object.
 
Gowher Naik
Ranch Hand
Posts: 643
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
b is reference to a object of type button.Button object is stored on heap.
 
Aum Tao
Ranch Hand
Posts: 210
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Also, objects dont have a name. Therefore, we can't access them directly.
We use references to access the objects.
 
Arun Maalik
Ranch Hand
Posts: 216
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks sir
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic