商城首页欢迎来到中国正版软件门户

您的位置:首页 > 编程开发 >java中@Inherited怎么使用

java中@Inherited怎么使用

  发布于2023-04-26 阅读(0)

扫一扫,手机访问

说明

1、标记表明某个标记的类型被继承,@inherited修饰的annotation类型被用于class,annotation被用于class的子类,@inheritedannotation类型被标记的class的子类。

作用

2、允许子类继承父类注释。

实例

MyParentClass在用的注释标记是@Inherited,子类可以继承注释信息。

java.lang.annotation.Inherited
@Inherited
public @interface MyCustomAnnotation {
}
 
@MyCustomAnnotation
public class MyParentClass {
  ...
}
 
public class MyChildClass extends MyParentClass {
   ...
}

Java有哪些集合类

Java中的集合主要分为四类:

1、List列表:有序的,可重复的;

2、Queue队列:有序,可重复的;

3、Set集合:不可重复;

4、Map映射:无序,键唯一,值不唯一。

本文转载于:https://www.yisu.com/zixun/579236.html 如有侵犯,请联系admin@zhengruan.com删除

热门关注