An entity that has state and behavior is
known as an object
An object holds both
variables and methods
state: represents data (value) of an object.
behavior: represents the behavior (functionality) of an
object such as deposit, withdraw etc.
Example: A Customer has states – name, account no, address as
well as behavior such as withdraw, deposit.
Object is an instance of a class. Class
is a template or blueprint from which objects are created. So object is the
instance (result) of a class.
Example: Customer customer=new Customer
();
No comments:
Post a Comment