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