You are on page 1of 12

Java OOP Concepts

A detailed explanation of Object-Oriented Programming in Java


Abstraction
• Abstraction is the concept of hiding
the complex reality while exposing
only the necessary parts. In Java, it's
achieved through abstract classes
and interfaces.
Encapsulation
• Encapsulation involves wrapping the data (variables) and code
(methods) together as a single unit. In Java, encapsulation is
implemented using access modifiers.
Inheritance
• Inheritance is a mechanism wherein a new class is derived from an
existing class. In Java, classes can inherit attributes and methods from
other classes.
Polymorphism
• Polymorphism allows us to perform a single action in different ways.
In Java, this is done using method overloading and overriding.
Association
• Association establishes a relationship between two separate classes
through their objects. The relationship can be one-to-one, one-to-
many, many-to-one, or many-to-many.
Composition
• Composition is a more restricted form of Association where one class
owns another class's object. It's a 'part-of' relationship with a lifecycle
dependency.
Aggregation
• Aggregation is a specialized form of Association where all objects have
their own lifecycle but there is an ownership. It represents a 'has-a'
relationship.
Delegation
• Delegation is a design pattern where an object handles a request by
delegating to a second object (the delegate).
Coupling
• Coupling refers to the degree of direct knowledge one class has of
another. Low coupling is often a sign of a well-structured computer
system.
Cohesion
• Cohesion refers to the degree to which the elements inside a module
belong together. High cohesion means that the responsibilities of a
single module are closely related.
Collection Framework
• The Collection Framework in Java is a set of classes and interfaces
that implement commonly reusable collection data structures like
lists, sets, and maps.

You might also like