To me 'object' and 'instance' are synonyms; 'instance' sounds a bit spiffier though.
The class is the blueprint and the object/instance is an instantiation (sic) of the blueprint.
Hi all,
What is the difference between object & Instance in Java??
Thanks in Advance
-Hamsa
Hi
as I understood so far Objects are derived from class and Instance is the process/mechanism which creates an object. Tell me where do you have confussion.
Hi
as I understood so far Objects are derived from class and Instance is the process/mechanism which creates an object. Tell me where do you have confussion.
You're talking about "instantiat ion" here (the process of creating an instance of
a class, the instance is synonymous to an "object").
Hi all,
What is the difference between object & Instance in Java??
Thanks in Advance
-Hamsa
An instance is an object with state. All pencils have erasers and lead. But one pencil I hold in my hand, this instance of this pencil has a pink eraser and sharp point. My brother's pencil has a blue eraser with ear wax on it (yes, pencils can be used as que tips), bite marks, and a dull point. They are both objects of the same class but different instances.
An object can have state but it needn't; it is
still an instance of some class.
kind regards,
Jos
An object always have a state of some sort. I might be using the term more abstractly than I should. I see it as something that seperates one instance from another instance. Even a difference in memory address could be considered as a different state, in my mind. Furthermore, all objects have an initialized state even if they don't have instance variables.
An object always have a state of some sort. I might be using the term more abstractly than I should. I see it as something that seperates one instance from another instance. Even a difference in memory address could be considered as a different state, in my mind. Furthermore, all objects have an initialized state even if they don't have instance variables.
I was responding to this:
Originally posted by kreagan
An instance is an object with state.
That implies that an object needn't have state while an instance has state. IMHO
an ojbect is an instance; both are a 'realization' of a class. I'm running out of
synonyms here.
Comment