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 is the difference between String, StringBuilder and StringBuffer?

    String is immutable, so every change creates a new object. StringBuilder and StringBuffer are mutable and change the same object in place. StringBuffer's methods are synchronized (thread-safe but slower), while StringBuilder is not synchronized and is the usual choice for building strings in a single thread.

    BeginnerIn-depth3 min read