Java.lang.Package.getAnnotations() Method

Description

The java.lang.Package.getAnnotations() method returns all annotations present on this element. (Returns an array of length zero if this element has no annotations.) The caller of this method is free to modify the returned array; it will have no effect on the arrays returned to other callers.

Declaration

Following is the declaration for java.lang.Package.getAnnotations() method

public Annotation[] getAnnotations()

Parameters

NA

Return Value

This method returns all annotations present on this element

Exception

NA

Example

The following example shows the usage of lang.Object.getAnnotations() method.