Skip to main content

What are Java annotations?

Junior Java
Quick Answer Annotations are metadata attached to code elements (classes, methods, fields). Built-in: @Override (verify you're overriding), @Deprecated (mark as obsolete), @SuppressWarnings. Create custom annotations with @interface. Frameworks use annotations heavily for configuration (Spring @Component, @Autowired; JPA @Entity, @Column). Annotations are processed at compile time (retention COMPILE) or runtime (retention RUNTIME via reflection).

Answer

Annotations provide metadata for code.
Affect compilation or runtime behavior.
Examples: @Override, @Deprecated, @SuppressWarnings.
S
SugharaIQ Editorial Team Verified Answer

This answer has been peer-reviewed by industry experts holding senior engineering roles to ensure technical accuracy and relevance for modern interview standards.

Want to bookmark, take notes, or join discussions?

Sign in to access all features and personalize your learning experience.

Sign In Create Account

Source: SugharaIQ

Ready to level up? Start Practice