//Info.java import java.lang.annotation.*; @Retention(RetentionPolicy.RUNTIME) @Documented @Target({ElementType.METHOD, ElementType. TYPE}) @Inherited @interface Info { String Name() default "None"; String ExpiryDate() default "10.01.1980"; }
@Info(Name="Car", ExpiryDate="10.14.2017") public class Car { @Info(Name="f1", ExpiryDate="10.01.2017") public void f1() { System.out.println("f1 in Car ..."); } @Info(Name="f2", ExpiryDate="10.14.2017") public void f2() { System.out.println("f2 in Car ..."); } }
import java.lang.annotation.*; public class Buick extends Car { @Override public void f2() { System.out.println("f2 in Buick ..."); } @Deprecated public void f3() { System.out.println("f3 in Buick ..."); } }