Help the world stop coronavirus! Stay home!

Prev Next

Java / Annotations

How do I create a custom Java Annotation?

Java Annotation definition resembles an interface definition where the keyword interface is preceded by @. @ represents Annotation type (AT).

The Java Annotation body contains annotation type element declarations that look like method and also can define an optional default value.

package net.javapedia.annotations;

public @interface CustomAnnotation {

	int value();


package net.javapedia.annotations;

public class AnnotatedClass {


❤Cash Back At Stores you Love !!!❤

Earn your $10 reward when you make your first purchase through Ebates by signing up with clicking below button.

Ebates Coupons and Cash Back

More Related questions...

Show more question and Answers...


Comments & Discussions