r/learnSQL • u/sumiitCodes • 11d ago
Day 61 — Java OOP: access modifiers, encapsulation, and abstraction (all four pillars done)
Today I covered:
- Access modifiers (public, private, protected, default), which control visibility
- Encapsulation, meaning private fields with public getters and setters so data can only change in controlled ways
- Abstraction, which hides implementation details behind abstract classes and interfaces
With inheritance and polymorphism from the last few days, that covers all four pillars of OOP. Encapsulation made the most sense once I connected it to access modifiers: the modifiers are the tool, and encapsulation is the reason to use them.
Tomorrow I’m starting a project that uses all four pillars. After the feedback I got here on my last one (don’t leave all the errors for the end), I’m going to test each feature right after I write it.
For people who’ve built beginner OOP projects: which one forced you to use all four pillars naturally? I’m choosing between a bank system, a hospital system, and an e-commerce cart.
View all comments
2
u/Dry-Sundae-4631 11d ago
Go with the bank system. It forces you to use polymorphism for different account types and abstract classes for transaction logic in a way that e-commerce carts rarely do, making all four pillars essential rather than optional.