0% found this document useful (0 votes)
4 views2 pages

Java OOP Handwritten Notes

Object Oriented Programming (OOP) in Java involves designing software using objects that encapsulate data and behavior. The four pillars of OOP are Encapsulation, Inheritance, Abstraction, and Polymorphism, each serving to enhance code security, reusability, and manageability. OOP effectively models real-world systems, making it easier to extend and maintain code.

Uploaded by

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

Java OOP Handwritten Notes

Object Oriented Programming (OOP) in Java involves designing software using objects that encapsulate data and behavior. The four pillars of OOP are Encapsulation, Inheritance, Abstraction, and Polymorphism, each serving to enhance code security, reusability, and manageability. OOP effectively models real-world systems, making it easier to extend and maintain code.

Uploaded by

zk15505123
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Java OOP – Handwritten Style Notes

Object Oriented Programming (OOP)


OOP is a programming approach where software is designed using objects. An object contains
data (variables) and behavior (methods). Java follows OOP to model real-world systems.
Four Pillars of OOP:

• Encapsulation

• Inheritance

• Abstraction

• Polymorphism

1. Encapsulation
Encapsulation means wrapping data and methods into a single unit (class) and hiding the data from
direct access using access modifiers.
How: private variables + public getters/setters
Why: Data security and controlled access
Example: ATM machine (balance is hidden)

• Improves data security

• Makes code maintainable

• Controls modification of data

2. Inheritance
Inheritance allows a child class to acquire properties and methods of a parent class using the
'extends' keyword.
Why: Code reusability and hierarchy
Example: Animal → Dog
Types:

• Single Inheritance

• Multilevel Inheritance

• Hierarchical Inheritance

3. Abstraction
Abstraction means hiding implementation details and showing only essential features to the user.
Achieved by: Abstract classes and Interfaces
Example: Car (we know how to drive, not engine internals)
• Reduces complexity

• Improves security

• Focuses on functionality

4. Polymorphism
Polymorphism means one method or object behaving in different ways.
Types:

• Compile-time Polymorphism (Method Overloading)

• Run-time Polymorphism (Method Overriding)


Example: Same remote button works differently for TV and AC

Why We Use OOP


• Models real-world problems

• Improves reusability

• Makes code secure and maintainable

• Easy to extend and manage

You might also like