ITPub博客

首页 > IT职业 > IT图书 > java @Documented怎么用?

java @Documented怎么用?

IT图书 作者:emanda 时间:2021-09-11 09:55:46 0 删除 编辑

说明

1、@Documented用于描述其他类型的annotation应该作为标记的程序成员的公共应用编程接口,因此可以作为javadoc等工具文档。Documented是标记注释,没有成员。

作用

2、将注释包含在javadoc中。

实例

@Documented
@interface B{
 
    String value() default "这是一个自定义类";
}
 
@B
public class MyTest2 {
 
    public static void main(String[] args) throws Exception{
        Class<?> c=Class.forName("hello3.B");
        System.out.println(c);
    }
}

以上就是java @Documented的用法,希望对大家有所帮助。更多Java学习指路:Java基础

本教程操作环境:windows7系统、java10版,DELL G3电脑。

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/1741/viewspace-2830012/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2019-04-15

  • 博文量
    208
  • 访问量
    2571