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. How can polymorphism replace a long if-else or switch chain?

    Give each case its own class with the same method, then call that method on the object. Adding a new case means adding a class, not editing the old, tested chain.

    IntermediateQuick answer1 min read
  2. What is dynamic method dispatch in Java?

    It is the way Java chooses which overridden method to run at runtime, based on the actual object type and not on the type of the reference variable.

    IntermediateQuick answer1 min read