Interview Q&A / Object-Oriented Programming
Object-Oriented Programming interview questions
The four pillars, interfaces, abstract classes and design basics.
Prefer rapid revision? Practise Object-Oriented Programming short interview answers →
- Why use getters and setters when we could make fields public?
Methods let a class validate input, compute values, log changes, and change its internal storage later without breaking callers. A public field gives up all of that control.
BeginnerQuick answer1 min read