Object-Oriented Programming in Java - Detailed Notes
Object-Oriented Programming Concepts and Fundamentals
1. Introduction to OOP Concepts
- Class: Blueprint for objects. Example: class Student { String name; int age; }
- Object: Instance of class. Example: Student s1 = new Student();
- Encapsulation: Wrapping data + methods. Example: private int balance; public getBalance()
- Inheritance: Reuse code from parent class. Example: class Dog extends Animal
- Data Hiding: Using private access to protect data.
- Abstraction: Hiding internal complexity. Example: abstract class Shape { abstract void draw(); }
- Polymorphism: One thing many forms. Example: method overloading & overriding.
2. Data Types, Literals, Variables, Arrays, Operators, Control Flow
- Data Types: int, float, double, char, boolean etc.
- Literals: Actual values like 10, 'A', "Hello"
- Variables: Named memory locations. int age = 25;
- Arrays: Group of same type values. int[] arr = {1,2,3};
- Operators: + - * /, > < ==, && || etc.
- Control Flow: if-else, switch, for, while, do-while loops