Section 1: Java Basics
Variables and Data Types
• Java has strong and static typing.
• Primitive types: int, byte, short, long, float,
double, boolean, char.
• Reference types: Objects and Arrays.
• Use 'var' for type inference (Java 10+).
Operators in Java
• Arithmetic: +, -, *, /, %
• Relational: ==, !=, >, <, >=, <=
• Logical: &&, ||, !
• Assignment and Unary Operators
Conditional Statements
• if, else if, else blocks
• switch-case for multiple condition checks
• Use break to exit switch block
• Enhanced switch (Java 14+)
Loops in Java
• for, while, do-while loops
• Enhanced for loop for arrays/collections
• Use break and continue wisely
Arrays and Strings
• Arrays are fixed-size containers
• String is immutable in Java
• Common String methods: length(), charAt(),
substring(), equals()
• StringBuilder for mutable strings