- public class ZhuJieText {
- public static void main(String[] args) {
- ZhuJie z = (ZhuJie)Demo.class.getAnnotation(ZhuJie.class);
- System.out.println(z.value());
- }
- }
- @Retention(RetentionPolicy.RUNTIME)
- @Target({ElementType.METHOD,ElementType.TYPE})
- @interface ZhuJie {
- String value() ;
- }
- @ZhuJie("abc")
- class Demo{
- @ZhuJie("123") //传入的123不会把abc给替换掉吗?
- public static void show(){}
- }
复制代码
为何代码没复制到里面呢 |