java中@Inherited怎么使用
更新:HHH   时间:2023-1-7


本篇内容主要讲解“java中@Inherited怎么使用”,感兴趣的朋友不妨来看看。本文介绍的方法操作简单快捷,实用性强。下面就让小编来带大家学习“java中@Inherited怎么使用”吧!

说明

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映射:无序,键唯一,值不唯一。

到此,相信大家对“java中@Inherited怎么使用”有了更深的了解,不妨来实际操作一番吧!这里是天达云网站,更多相关内容可以进入相关频道进行查询,关注我们,继续学习!

返回大数据教程...