Java OOP Concepts 1
Java OOP Concepts 1
OOps (Object-Oriented Programming System) - object means a real-world entity such as pen, chair, table.
OOP is a methodology of paradigm to design a program using classes and objects. It simplifies soft develop.
by providing some concepts:
Object
Class
Inheritance
Polymorphism
Abstraction
Encapsulation
Apart from these concepts, there are some other termins which are used in OOP design:
Coupling
Cohesion
Assocation
Aggregation
Composition
OBJECT:
CLASS:
INHERITANCE:
when one object acquires all the properties and behaviours of a parent object, it is known as
inheritance, it provides code reusability. It is used to achieve runtime polymorphism.
POLYMORPHISM:
ABSTRACTION:
ENCAPSULATION:
Binding (or wrapping) code and data together into a single unit are known as encapsulation.
For example: a capsule - it is wrapped with different medicines
JAVA CLASS is the example of encapsulation. JAVA BEAN is the fully encapsulated class because all
the data members are private.
COUPLING:
COHESION:
ASSOCIATION:
relationship between the objects (one object can be associated with one or many objects)
There can be four types of association between the objects (one to one, one to many, many to one,
many to many)
Example: one country can have one prime minister(one to one), prime minister can have many
ministers (one to many), Also many MP's can have one prime minister(many to one), many ministers
can have many departments(many to many).
can be undirectional or bidirectional
AGGREGATION:
COMPOSITION: