Java / Lombok Interview questions
What is Lombok?
Lombok is a Java library that removes boilerplate code — getters, setters, constructors,
equals/hashCode, toString, and more — by generating it
automatically at compile time from simple annotations, rather than you writing it by hand.
import lombok.Getter; import lombok.Setter; public class Person { @Getter @Setter private String name; @Getter @Setter private int age; }
Behind the scenes, Lombok plugs into the Java compiler as an annotation processor: it reads your source file, generates the missing methods directly into the compiled bytecode, and your IDE (with the Lombok plugin installed) shows those generated methods as if they were written normally. The source file itself never actually contains the generated code — it's added during compilation.
More Related questions...