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. What is a constructor, and what is constructor chaining?

    A constructor is a special method with the class's name and no return type that runs when an object is created, to set its starting state. Constructor chaining is one constructor calling another, either in the same class with this(...) or in the parent class with super(...), so setup code is written once.

    BeginnerIn-depth3 min read
  2. What are the types of inheritance, and which does Java support through classes?

    Single, multilevel, hierarchical, multiple and hybrid. Java supports the first three with classes; multiple inheritance of classes is not allowed, but a class can implement many interfaces.

    BeginnerQuick answer1 min read
  3. What are the uses of the super keyword?

    super refers to the parent part of the current object. It calls the parent constructor, calls a parent method that the child has overridden, or reaches a parent field hidden by a child field.

    BeginnerQuick answer1 min read