Skip to content
Sharp

Java Annotations · interview question

How does Lombok help in reducing boilerplate code for Java classes?

Multiple choiceMediumchapter-16-curatedpremiumjava-annotationsannotation-processors
Choose one answer
Answer and explanation

Correct answer

D. By generating code at compile-time.

Why

Lombok reduces boilerplate by generating code like getters, setters, and constructors during compile-time. It integrates with the Java compiler to modify the AST, effectively adding these methods without cluttering the source code.

Test yourself on Java Annotations

A free test with instant, explained results. No account needed.

Start free test
All Java Annotations questions →