Java interview questions — 9 years experience
These are the questions a candidate with 9 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.
How does Spring AOP work, and what are its limits?
Spring builds a proxy around your bean — a JDK dynamic proxy if it has an interface, a generated subclass otherwise — and the advice lives in the proxy, not in your class. Every limit follows: self-invoked, private, final and static methods never cross the proxy, so an annotation on them does nothing and nothing warns you.
Asked constantlyintermediate2–10 yrs11 min readSpring aopWhat does volatile guarantee, and what does it not?
volatile guarantees visibility and ordering: a write is seen by any later read, and operations are not reordered across it. It never guarantees atomicity, so volatile count++ still loses updates — it is three operations, and volatile makes each of them visible without making the trio indivisible.
Asked constantlyintermediate1–12 yrs12 min readConcurrency