Documented注释的作用及其javadoc文档生成工具的使用

代码放在MyDocumentedtAnnotationDemo.java文件中

package org.yu.demo16.documentedannotation ;

import java.lang.annotation.Documented ;

@MyDocumentedtAnnotation(key="小雨",value="中国地质大学")

public class MyDocumentedtAnnotationDemo{

        

         @MyDocumentedtAnnotation(key="小雨",value="中国地质大学")

         public String toString(){

                   return "hello yu..." ;

         }

};

 

@Documented

@interface MyDocumentedtAnnotation{

         public String key() default "yu" ;

         public String value() default "cug" ;

}

仔细看看下面的编译的结果:

Annotation深入研究——@Documented注释使用

在java文件所在的路径中可以发现生成了doc文件夹,打开文件夹,打开index.html可以发现查看生成的文档

Annotation深入研究——@Documented注释使用

下面是Documented注释用在类上的作用:给类添加注释

Annotation深入研究——@Documented注释使用

下面是Documented注释用在类方法上的作用:给类方法添加注释

Annotation深入研究——@Documented注释使用

 

相关文章:

  • 2021-07-21
  • 2021-09-25
  • 2021-08-05
  • 2021-08-30
  • 2022-12-23
  • 2022-12-23
  • 2021-11-28
  • 2022-12-23
猜你喜欢
  • 2021-09-15
  • 2022-01-26
  • 2022-01-10
  • 2022-02-25
  • 2021-08-26
  • 2021-09-12
  • 2022-01-07
相关资源
相似解决方案