Interview Q&A / Object-Oriented Programming

INTERVIEW Q&A · 69 QUESTIONS

Object-Oriented Programming interview questions

The four pillars, interfaces, abstract classes and design basics.

  1. 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