Java interview questions — 0 years experience

These are the questions a candidate with 0 years of experience gets asked. The same question is asked at many levels — what changes is how deep the follow-ups go, so read section 3 of each entry.

  • When would you use LinkedList instead of ArrayList?

    Almost never. LinkedList only wins at the ends of the list, and when you need that you want ArrayDeque instead. Its famous advantage — cheap mid-list insertion — is 23x slower than ArrayList on real hardware, because you must walk to the index first.

    Asked constantlyintermediate0–8 yrs9 min readCollections
  • Why is String immutable, and what is the string pool?

    String is immutable because nothing in its API exposes a mutator — not because its byte[] field is final. The pool is a JVM-wide cache of literals that makes == accidentally work on literals and fail everywhere else.

    Asked constantlyintermediate0–8 yrs9 min readStrings
  • What is the difference between checked and unchecked exceptions?

    Checked exceptions are enforced by the compiler; unchecked ones are not. The interesting question is not the definition but why every major Java framework since 2004 has moved to unchecked exceptions — and lambdas finished the argument in Java 8.

    Asked constantlyintermediate0–8 yrs10 min readExceptions

Other experience levels