Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels) Summary: [Methods](https://developer.android.com/reference/java/lang/annotation/Target#pubmethods) \| [Inherited Methods](https://developer.android.com/reference/java/lang/annotation/Target#inhmethods)

# Target


`
public


abstract
@interface
Target
`


`


implements

https://developer.android.com/reference/java/lang/annotation/Annotation


`

|---|
| java.lang.annotation.Target |

<br />

*** ** * ** ***

Indicates the contexts in which an annotation interface is applicable. The
declaration contexts and type contexts in which an annotation interface may
be applicable are specified in JLS {@jls 9.6.4.1}, and denoted in source code by
enum constants of `https://developer.android.com/reference/java/lang/annotation/ElementType`.

If an `@Target` meta-annotation is not present on an annotation
interface `T`, then an annotation of type `T` may be written as
a modifier for any declaration.

If an `@Target` meta-annotation is present, the compiler will enforce
the usage restrictions indicated by `ElementType`
enum constants, in line with JLS {@jls 9.7.4}.

For example, this `@Target` meta-annotation indicates that the
declared interface is itself a meta-annotation interface. It can only be
used on annotation interface declarations:

```
   @Target(ElementType.ANNOTATION_TYPE)
   public @interface MetaAnnotationType {
       ...
   }
```

This `@Target` meta-annotation indicates that the declared class or
interface is intended solely for use as a member class or interface in
complex annotation interface declarations. It cannot be used to annotate
anything directly:

```
   @Target({})
   public @interface MemberInterface {
       ...
   }
```

It is a compile-time error for a single `ElementType` constant to
appear more than once in an `@Target` annotation. For example, the
following `@Target` meta-annotation is illegal:

```
   @Target({ElementType.FIELD, ElementType.METHOD, ElementType.FIELD})
   public @interface Bogus {
       ...
   }
```

<br />

## Summary

| ### Public methods ||
|---|---|
| ` https://developer.android.com/reference/java/lang/annotation/ElementType` | ` https://developer.android.com/reference/java/lang/annotation/Target#value()() ` Returns an array of the kinds of elements an annotation interface can be applied to. |

| ### Inherited methods |
|---|---|
| From interface ` https://developer.android.com/reference/java/lang/annotation/Annotation ` |---|---| | ` abstract https://developer.android.com/reference/java/lang/Class<? extends https://developer.android.com/reference/java/lang/annotation/Annotation>` | ` https://developer.android.com/reference/java/lang/annotation/Annotation#annotationType()() ` Returns the annotation interface of this annotation. | | ` abstract boolean` | ` https://developer.android.com/reference/java/lang/annotation/Annotation#equals(java.lang.Object)(https://developer.android.com/reference/java/lang/Object obj) ` Returns true if the specified object represents an annotation that is logically equivalent to this one. | | ` abstract int` | ` https://developer.android.com/reference/java/lang/annotation/Annotation#hashCode()() ` Returns the hash code of this annotation. | | ` abstract https://developer.android.com/reference/java/lang/String` | ` https://developer.android.com/reference/java/lang/annotation/Annotation#toString()() ` Returns a string representation of this annotation. | ||

## Public methods

### value

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public ElementType[] value ()
```

Returns an array of the kinds of elements an annotation interface
can be applied to.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/lang/annotation/ElementType` | an array of the kinds of elements an annotation interface can be applied to <br /> |