# - The Ultimate Cheatsheet: 1. Basic Syntax and Types
# - The Ultimate Cheatsheet: 1. Basic Syntax and Types
2. Operators
3. Control Flow
● If statement: if (condition) { }
● If-else statement: if (condition) { } else { }
● If-else if-else statement: if (condition1) { } else if (condition2) {
} else { }
● Nested if: if (condition1) { if (condition2) { } }
● Switch statement: switch (variable) { case value: break; default:
break; }
● For loop: for (int i = 0; i < 10; i++) { }
● Enhanced for loop: for (String item : list) { }
● While loop: while (condition) { }
● Do-while loop: do { } while (condition);
● Infinite loop: while (true) { }
● Break statement: break;
outerloop:
for (int i = 0; i < 5; i++) {
for (int j = 0; j < 5; j++) {
if (condition) break outerloop;
}
}
outerloop:
for (int i = 0; i < 5; i++) {
for (int j = 0; j < 5; j++) {
if (condition) continue outerloop;
}
}
● Return statement: return value;
● Yield statement (Java 13+): yield value;
4. Arrays
5. Strings
6. Methods
7. Object-Oriented Programming
● Builder pattern:
8. Exception Handling
9. Collections Framework
10. Generics
12. Multithreading
16. Networking
17. Reflection
18. Annotations