Instance refers to the copy of the object at a particular time whereas object refers to the memory address of the class.
OR,
OR,
eg:Bike b1=new Bile();
Bike b2=new Bike()
—->we create two instances for storing two bike object values.
→At this stage b1&b2 are just instances because they have not contain any Bike object values.
—-> after storing values in instances then they are treated as objects
—-> we can store values in instances in 3 ways
1.Directly by assigning values to variables
2.Through constructers
3. Through setter methods
like
b1.brand=”pulsur”
then the b1 contains values so we can say it object
OR,
instance means just creating a reference(copy) .
object :means when memory location is associated with the object( is a runtime entity of the class) by using the new operator
OR,
Instance referes to Reference of an object.
Object is actaully pointing to memory address of that instance.
No comments:
Post a Comment