Python知识分享网 - 专业的Python学习网站 学Python,上Python222
最全Java注解图文超详解(建议收藏) PDF 下载
发布于:2023-11-30 11:00:36
(假如点击没反应,多刷新两次就OK!)

最全Java注解图文超详解(建议收藏) PDF 下载  图1

 

 

 

 

资料内容:

 

1.创建自定义注解
1. /**
2. * 自定义注解例子
3. *
4. * @author mikechen
5. */
6.
7. @Documented
8. @Retention(RetentionPolicy.RUNTIME)
9. @Target(ElementType.METHOD)
10. @Inherited
11. public @interface HelloAnnotation {
12. String value();
13. }
 
2.使用自定义注解
1. /*
2. * 使用自定义注解
3. *
4. * @author mikechen
5. */
6. public class HelloAnnotationClient {
7. @HelloAnnotation(value="Simple custom Annotation example")
8. public void sayHello(){
9. System.out.println("Inside sayHello method..");
10. }
11. }