Java by API/java.lang.annotation/RetentionPolicy

Материал из Java эксперт
Версия от 17:23, 31 мая 2010; Admin (обсуждение | вклад) (1 версия)
(разн.) ← Предыдущая | Текущая версия (разн.) | Следующая → (разн.)
Перейти к: навигация, поиск

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

   <source lang="java">
    

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() {
 }

}



 </source>