**OOPS in Java – Short Notes**
**1. Objects & Classes**
- Object: Instance of a class with state and behavior.
*Example:* Car c = new Car();
- Class: Blueprint/template to create objects.
**2. Encapsulation**
- Binding data + methods.
- Achieved using private fields + public getters/setters.
**3. Polymorphism**
- Many forms of a method.
- Types: Compile-time (overloading), Runtime (overriding).
**4. Inheritance**
- One class acquiring features of another.
- Uses 'extends'.
*Example:* class Dog extends Animal.
**5. Java Basics**
- Compilation: javac [Link]
- Execution: java ClassName
- Compiler converts to bytecode; JVM interpreter executes bytecode.
- Data Types: int, float, double, char, boolean, byte, short, long.
**6. Class & Object**
- Instance fields: object-level variables.
- Methods: behavior.
- Access Modifiers: public, private, protected, default.
- Constructors: Special method to initialize object.
- Static: Shared by all objects.
- Final: Constant values; final class cannot be inherited.
**7. Type Conversion & Promotion**
- Widening: automatic (int → long)
- Narrowing: explicit.
**8. Polymorphic Forms**
- Method Overloading: Same method name, different parameters.
- Objects as parameters/return types.
**9. Input-Output**
- Input: Scanner class.
- Output: [Link]().
**10. Object Class**
- toString(): returns string form.
- equals(): compares two objects.
**11. Arrays & Strings**
- 1D, 2D arrays.
- ArrayList: dynamic array.
- Strings: Immutable.
- StringBuilder: Mutable string.
- StringTokenizer: Splits strings.
**12. Inheritance in Detail**
- Extending classes.
- Abstract class: cannot be instantiated; contains abstract methods.
- Final class: cannot be extended.
- Method Overriding: redefining method in subclass.
- Runtime Polymorphism: dynamic binding.
- Inner Classes:
- Static nested
- Non-static
- Local classes
**13. Interfaces**
- Multiple inheritance supported.
- Comparable: natural order.
- Comparator: custom sorting.
- Iterators: iterate through collections.
- LinkedList: doubly linked list implementation.
**14. Exception Handling**
- Exception: runtime error.
- Try-catch-finally.
- Creating custom exceptions.
**15. Packages**
- Organize classes.
- Use 'package' and 'import'.
**16. Garbage Collector**
- Frees unused memory.
- Can request using [Link]().
**17. Multithreading**
- Thread class / Runnable interface.
- Life cycle: New → Runnable → Running → Blocked → Terminated.
- Synchronization: prevents race conditions.
- Thread priority: affects scheduling.