Object-Oriented Programming Paradigms
- Encapsulation: Combines data and methods in one unit; protects internal state using access
modifiers.
- Abstraction: Shows only essential details; hides complex implementation using abstract classes
and interfaces.
- Inheritance: One class inherits properties and behaviors from another; promotes code reuse.
- Polymorphism: Allows methods to behave differently based on object; achieved by overloading and
overriding.
Java Programming Fundamentals
- Java History: Developed by James Gosling, released in 1995 by Sun Microsystems.
- Java Features: Platform-independent, secure, robust, object-oriented, portable, and multithreaded.
- Java Architecture: Source code compiled to bytecode, run by JVM on any platform.
- Java Security: Uses classloader, bytecode verifier, and security manager to prevent malicious
code execution.
Garbage Collection & Memory Management
- Garbage Collection: Automatic process to free unused memory by destroying unreferenced
objects.
- Memory Areas: Heap (object storage), Stack (method calls & local variables).
- Benefits: Prevents memory leaks, improves performance, simplifies memory handling.
Java Syntax, Constants, Variables, Data Types
- Constants: Declared with 'final', value cannot change after initialization.
- Variables: Named storage for data; must be declared with a type.
- Data Types: Primitive (int, float, char, etc.), Non-primitive (Strings, Arrays, Objects).
- Syntax: Java is case-sensitive, ends statements with semicolons, uses class-based structure.
Operators, Expressions, Type Conversion & Casting
- Operators: Arithmetic, Relational, Logical, Assignment, Bitwise, Unary.
- Expressions: Combination of variables and operators that result in a value.
- Type Conversion: Implicit (widening), automatic conversion to a larger data type.
- Type Casting: Explicit (narrowing), manually convert to a smaller data type using cast.
Control Statements
- Decision-making: if, if-else, nested if, switch.
- Looping: for, while, do-while loops for repeated execution.
- Jump Statements: break, continue, return control within loops and methods.
Methods, Constructors, Access Specifiers, Modifiers
- Methods: Group of statements to perform a task; improves modularity and reusability.
- Constructors: Special methods to initialize objects; called automatically when object is created.
- Access Specifiers: Control visibility - public, private, protected, default.
- Modifiers: Add functionality - static (class level), final (constant), abstract (no body).
Overloading, Recursion
- Method Overloading: Same method name with different parameters within the same class.
- Constructor Overloading: Multiple constructors with different parameter lists.
- Recursion: A method that calls itself; useful in problems like factorial, Fibonacci, etc.
String Handling
- String Class: Immutable; operations create new strings.
- StringBuilder: Mutable; used for efficient string manipulation.
- Common Methods: length(), charAt(), substring(), equals(), toUpperCase(), compareTo().
- String Concatenation: Performed using '+' operator or StringBuilder methods.