Interview Q&A / Java

INTERVIEW Q&A · 72 QUESTIONS

Java interview questions

Collections, the JVM, strings, exceptions and threads, the backbone of most campus placement rounds.

  1. What are the four pillars of object-oriented programming in Java?

    Encapsulation hides data behind methods, abstraction exposes only what matters, inheritance reuses a parent class, and polymorphism lets one call behave differently depending on the actual object.

    BeginnerQuick answer1 min read
  2. What is constructor chaining in Java and are constructors inherited?

    Constructors are not inherited. Every constructor starts by calling another one, either this(...) in the same class or super(...) in the parent, and Java inserts super() automatically if you write neither.

    BeginnerQuick answer1 min read
  3. What is the difference between encapsulation and abstraction in Java?

    Abstraction hides complexity by showing only what a user needs, usually through interfaces or abstract classes. Encapsulation hides data by keeping fields private and exposing controlled methods. One is about design, the other about protection.

    BeginnerQuick answer1 min read
  4. What is the difference between method overloading and method overriding in Java?

    Overloading is several methods with the same name but different parameters in one class, resolved at compile time. Overriding is a subclass replacing a parent method with the same signature, resolved at runtime.

    BeginnerQuick answer1 min read