1. Four Pillars of OOP
1. Encapsulation — bind data + methods; use private fields + getters/setters
2. Abstraction — hide complexity (abstract class / interface)
3. Inheritance — is-a relationship; code reuse (extends)
4. Polymorphism — one interface, many forms
Overloading (compile-time): same name, different params
Overriding (runtime): subclass redefines parent method
2. Classes, Interfaces, Access
class can have fields, constructors, methods
interface — pure contract (Java 8+ default methods)
abstract class — partial implementation
Access modifiers: private < default < protected < public
this → current object · super → parent
3. Exceptions & Collections
Checked (compile-time): IOException, SQLException
Unchecked: RuntimeException, NullPointerException
try → catch → finally · throw / throws
Collections
- List: ArrayList, LinkedList
- Set: HashSet, TreeSet
- Map: HashMap, TreeMap
- Queue: PriorityQueue, ArrayDeque
Prefer interfaces in declarations: List<String> list = new ArrayList<>();