3. CONT….
• It consider the
programming
simulated to real
world objects.
• It help in
programming
approach in order
to built robust
user friendly and
efficient
software's and
provide the
efficient way to
maintain real
world software's.
4. CLASS
• The first concept
that you will need
to learn is called
a "class.“
• A class creates
the attributes of a
thing, and it will
also define the
processes that the
thing can carry
out.
• For example, a
class called
"cats"
5.
6. OBJECT
An object can be defined as a
specific instance of a class.
As an example, while the class Cats
will provide all the attributes that are found in
all cats, the "object" named “HARLEY” is a
specific cat.
While it shares the same attributes
which are found in all cats, it has fur with a
unique color.
7. Example
In order to clearly understand the
object orientation, let’s take your “hand” as an
example.
The “hand” is a class. Your body has two
objects of type hand, named left hand and right hand.
Their main functions are controlled/ managed by a set
of electrical signals sent through your shoulders
(through an interface).
So the shoulder is an interface which
your body uses to interact with your hands. The hand is
a well architected class. The hand is being re-used to
create the left hand and the right hand by slightly
changing the properties of it.
8. Object
• An object stores
its state in fields
and exposes its
behavior through
methods.
• Methods operate
on an object's
internal state and
serve as the
primary
mechanism for
object-to-object
communication
9. CONT…..
• By attributing state
and providing
methods for
changing that state,
the object remains
in control of how
the outside world is
allowed to use it.
• For example, if the
bicycle only has 6
gears, a method to
change gears could
reject any value
that is less than 1 or
greater than 6.
10. INHERITANCE
• As the name suggests,
inheritance means to take
something that is already made.
• It is one of the most important
feature of Object Oriented
Programming.
• It is the concept that is used for
reusability purpose. Inheritance
is the mechanism through which
we can derived classes from
other classes.
11. CONT….
• The derived class is
called as child class or
the subclass or we
can say the extended
class and the class
from which we are
deriving the subclass
is called the base class
or the parent class.
• To derive a class in
java the keyword
extends is used.
12. INTERFACE
• An interface is a
collection of abstract
methods.
• A class implements an
interface, thereby
inheriting the abstract
methods of the
interface.
• An interface is not a
class. Writing an
interface is similar to
writing a class, but they
are two different
concepts.
13. CONT….
• A class describes the
attributes and
behaviors of an
object. An interface
contains behaviors
that a class
implements.
• Unless the class that
implements the
interface is abstract,
all the methods of the
interface need to be
defined in the class.
14. PACKAGES
• A Java package is a
mechanism for
organizing Java
classes into
namespaces similar
to the modules of
Modula.
• Java packages can
be stored in
compressed files
called JAR files,
allowing classes to
download faster as
a group rather than
one at a time.
15. CONT…
• Programmers also
typically use packages
to organize classes
belonging to the same
category or providing
similar functionality.
• A package provides a
unique namespace for
the types it contains.
• Classes in the same
package can access
each other's package-
access members.
16. DATA
ABSTRACTION
• Data abstraction
refers to,
providing only
essential
information to the
outside word and
hiding their
background
details .
• Data abstraction
is a programming
technique that
relies on the
separation of
interface and
implementation.
17. EXAMPLE….
Example of a
TV which you can turn
on and off, change the
channel, adjust the
volume, and add external
components such as
speakers, VCRs, and
DVD players.
BUT we do not
know it's internal detail
that is, you do not know
how it receives signals
over the air or through a
cable, how it translates
them, and finally displays
them on the screen.
18. ENCAPSULATION
It is an
attribute of
object design. It
means that all of
the object's data
is contained and
hidden in the
object and access
to it restricted to
members of that
class.
19. POLYMORPHISM
• It refers to a
programming
language’s ability to
process objects
differently depending
on their data type or
class.
• It is the ability to
redefine methods for
derived classes.
20. CONT…
For example,
given a base class shape,
polymorphism enables the
programmer to define
different area methods for
any number of derived
classes, such as circles,
rectangles and triangles.
No matter what
shape an object is, applying
the area method to it will
return the correct results.
Polymorphism
is considered to be a
requirement of any true
object-oriented
programming language
(OOPL).
21. DATA HIDING
Data Hiding is an
aspect of Object
Oriented
Programming (OOP)
that allows
developers to protect
private data and hide
implementation
details. In this
tutorial we examine
basic data hiding
techniques in Java.