RetentionPolicy: RetentionPolicy.RUNTIME (recorded by the compiler and retained by the VM at run time) : RetentionPolicy « java.lang.annotation « Java by API






RetentionPolicy: RetentionPolicy.RUNTIME (recorded by the compiler and retained by the VM at run time)

     


import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;

@Retention(RetentionPolicy.RUNTIME)
@interface MyAnnotation {
  String stringValue();

  int intValue();
}

public class Main {

  @MyAnnotation(stringValue = "Annotation Example", intValue = 100)
  public static void myMethod() {
  }

}

   
    
    
    
    
  








Related examples in the same category