Learn Encapsulation — a key concept for LLD interviews.
Interactive — Try it yourself!
How to use
1See the BankAccount class: private data (hidden) + public methods
2Click "🔒 Click to peek" — you're breaking encapsulation!
3Enter amount → click deposit() or withdraw()
4Try withdrawing more than balance → rejected by validation!
In a nutshell
Encapsulation bundles data + methods together and hides internal state. You can't directly set balance = -1000. You MUST use deposit() and withdraw() which enforce rules. Private data, public interface.