Return to site

JAVA ANNOTATIONS: @Inherited

#java #annotations #inherited

· java

Define:

@Inherited annotation indicates that the annotation type can be inherited from the super class.
(This is not true by default.)
This is a annotation for annotations.

It means that subclasses of annotated classes are considered having the same annotation as their superclass.

Snippet:

Prints:

null

@vv.Test$VVInherited()

@vv.Test$VVInherited()

@vv.Test$VVNone()

null

null