• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Which phrase is right??

 
srinivas koti
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Which is right?
"Instantiate a class" or "Instantiate an object"
Someone please clarify!
Thx
 
Rob Ross
Bartender
Posts: 2205
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Usually you talk about instantiating objects. You use the class as a template for constructing a new object.

Object myObject = new Object();

Can be read as:
instantiates an object of type "Object"
creates a new instance of class Object
creates a new object of type/class Object.
obtains the reference value returned from the instance creation expression 'new Object()' and stores it in the object reference variable 'myObject'.
But I think you'll be ok with the first 3!
Rob
 
Sals Hamid
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
we made instance of class e.g. we have class Salman we instantiate it by
Salman s = new Salman();
so s is the instance of class Salman
s is actually object. Class is not physical it just a boundary e.g An Architect made a map to build house, This map is class.There is no physical existance of class. We made house from class map, and this house is actually object which has physical existence
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic