Object-Oriented Programming (OOP) Using Java - Detailed Notes
Unit 1: Introduction to Object-Oriented Programming
1. Object-Oriented Programming (OOP) Overview:
- OOP is a programming paradigm based on real-world objects.
- It combines data (attributes) and behavior (methods).
2. Procedural vs. Object-Oriented Programming:
- Procedural: Follows a sequence of steps (e.g., C).
- OOP: Models real-world entities using classes and objects (e.g., Java).
3. Core OOP Concepts:
- Encapsulation: Hiding data using private access.
- Inheritance: Reusing parent class properties in child classes.
- Polymorphism: One interface, multiple implementations.
- Abstraction: Hiding implementation details.
4. Java Compilation & Execution Process:
- Source Code (.java) -> Bytecode (.class) -> Execution via JVM.
5. Security in JVM:
- Java provides memory protection, bytecode verification, and access control.
6. Sandbox Model:
- A security mechanism that restricts untrusted code execution.
Unit 2: Java Fundamentals
1. Data Types and Literals:
- Java supports primitive (int, float, boolean) and reference (String, Arrays) data types.
2. Wrapper Classes:
- Convert primitive types to objects (Integer, Double).
3. Arrays in Java:
- Used to store multiple values of the same type.
- Example:
int[] numbers = {1, 2, 3};
4. Operators in Java:
- Arithmetic: +, -, *, /
- Logical: &&, ||, !
5. Control Flow Statements:
- Conditional: if-else, switch
- Loops: for, while, do-while
6. Classes and Objects:
- A class is a blueprint; an object is an instance.
- Example:
class Car { String brand; }
7. Exception Handling:
- try-catch block handles runtime errors.
8. Collection API:
- Used for data structures (ArrayList, HashMap).
9. Iterators:
- Used to traverse collections.
- Example:
Iterator<Integer> it = list.iterator();