Object Oriented Programming Handwritten Notes
Object Oriented Programming Handwritten Notes
with Java
What is Object Oriented Programming ?
● An object can be defined as a data field that has unique attributes and behavior
● OOP focuses on the objects that developers want to manipulate rather than the logic
required to manipulate them
● Well-suited for programs that are large, complex and actively updated or maintained
● Beneficial to collaborative development, where projects are divided into groups
● Additional benefits of OOP include code reusability, scalability and efficiency
Principles of OOP
Encapsulation
Binding data and functions and prevent outside interference
Eg. A car with its attributes like color, make, model etc - which cannot be changed by
interference
Abstraction
Reveal only essential information and hide unnecessary information
Eg. How a car starts, moves and its different features
Inheritance
Extending existing functionality and promote re-use. Parent and child classes
Eg. A car can be derived into multiple sub-models with varying features
Polymorphism
Ability to take multiple forms in runtime. Retain its own behaviour while looks like its
parent
Eg. Car can be represented as a Vehicle, which can also represent a Truck, Van etc.
Java Overview
Java compiler compiles code into an intermediate instruction format called bytecode. This
bytecode can be executed on any platform that contains a Java Virtual Machine(JVM).
Hence the notion of Write Once Run Anywhere
Components of Java