@@ -0,0 +1,910 @@
+package com.yxy.chukonu.java.jdk18.annotation;%0A%0Aimport java.lang.annotation.ElementType;%0Aimport java.lang.annotation.Repeatable;%0Aimport java.lang.annotation.Target;%0A%0Apublic class AnnotationExample %7B%0A%09%0A%0A%09@interface Hints %7B%0A%09    Hint%5B%5D value();%0A%09%7D%0A%09%0A%09@Repeatable(Hints.class)%0A%09@interface Hint %7B%0A%09    String value();%0A%09%7D%0A%0A%09//old way%0A%09@Hints(%7B@Hint(%22hint1%22), @Hint(%22hint2%22)%7D)%0A%09class Person %7B%7D%0A%09%0A%09//new way%0A%09@Hint(%22hint1%22)%0A%09@Hint(%22hint2%22)%0A%09class Person2 %7B%7D%0A%09%0A%09@Target(%7BElementType.TYPE_PARAMETER, ElementType.TYPE_USE%7D)%0A%09@interface MyAnnotation %7B%7D%0A%0A%09public static void main(String%5B%5D args) %7B%0A%0A%09%09Hint hint = Person.class.getAnnotation(Hint.class);%0A%09%09System.out.println(hint);  // null%0A%09%09%0A%09%09Hints hints1 = Person.class.getAnnotation(Hints.class);%0A%09%09System.out.println(hints1.value().length);  // 2%0A%09%09%0A%09%09Hint%5B%5D hints2 = Person.class.getAnnotationsByType(Hint.class);%0A%09%09System.out.println(hints2.length);  // 2%0A%0A%09%09%0A%09%7D%0A%0A%7D%0A

add JDK1.8 new feature - annotation