0% found this document useful (0 votes)
33 views12 pages

Class-IX Chapter-3

Uploaded by

parasharaarna2
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
33 views12 pages

Class-IX Chapter-3

Uploaded by

parasharaarna2
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 12

Chapter- 3

Elementary Concept of
Objects and Classes
What is an object in Java
• An entity that has state and
behavior is known as an
object e.g., chair, bike,
marker, pen, table, car, etc.
• It can be physical or logical
(tangible and intangible).
• The example of an
intangible object is the
banking system.
Object Definitions
• An object is a real-world entity.
• An object is a runtime entity.
• The object is an entity which has state and
behavior.
• The object is an instance of a class.
What is a class in Java
• A class is a group of objects which have common properties.
• It is a template or blueprint from which objects are created.
• It is a logical entity.
• It can't be physical.
• A class in Java can contain:
– Fields
– Methods
– Constructors
– Blocks
– Nested class and interface
Object Encapsulate State and Behaviour

• Only the member methods which are


wrapped inside the class can access the data
and change its state.
• Hence, the state and behaviour are said to
encapsulate by the object, hiding internal
state and requiring all interaction to be
performed through an object's methods.
• An object stores its state in member
variables and exposes its behaviour
through the member methods.
• The member methods operate on
member variables and serve as the
primary mechanism to interact with
the object.
• Only the member methods which
are wrapped inside the class can
access the data and change its state.
• Hence, the state and behaviour are
said to be encapsulated by the
object, hiding internal state and
requiring all interaction to be
performed through the methods of
the object.
Message Passing between Objects
• Message passing in OOP
is a mechanism for
objects to communicate
and interact with each
other by sending
messages.
• It involves invoking
methods on objects, which
can lead to the exchange
of information, execution
of a specific behaviour, or
modification of an object's
state

You might also like