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 do APIs use static factory methods like List.of() instead of constructors?

    Static factory methods have names, can return cached or existing objects, can return a subtype, and can hide the implementation class. Constructors can do none of these.

    AdvancedQuick answer1 min read