- Annotation類的定義方式:public @interface MyAnnotation {
- retention 分:SOURCE,CLASS,RUNTIME
- annotation type分:TYPE,FIELD,METHOD,PARAMETER,CONSTRUCTOR,LOCAL_VARIABLE,ANNOTATION_TYPE,PACKAGE
type是加在類上面的註釋:spa

用的時候,直接在class上面註釋就好了:註釋是以annotation對象的形式存在的3d

獲取註釋對應屬性值的方法:對象
ans的長度是2blog

不用new bird 這樣就能夠了:MyAnnotation bb=Bird.class.getAnnotation(MyAnnotation.class);:get


- 若是是annotation type 是method ,那麼獲取有註解的方法:

七月又過了三分之二臥槽,睡覺了io