Question: Let's say I have an Annotation.

```java
@Documented
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD)
public @interface MyAnnotation {
    int value() default 1;
}

```

Is there any way to get the value of `1` using reflection or something?

Answer: 
How about

```
MyAnnotation.class.getMethod("value").getDefaultValue()

```
Yes, you can use [`Method#getDefaultValue()`](http://docs.oracle.com/javase/7/docs/api/java/lang/reflect/Method.html#getDefaultValue%28%29) which

> 
> Returns the default value for the annotation member represented by this `Method` instance.
> 
> 
> 

Take the following example

```
public class Example {
    public static void main(String[] args) throws Exception {
        Method method = Example.class.getMethod("method");
        MyAnnotation annot = method.getAnnotation(MyAnnotation.class);
        System.out.println(annot.value()); // the value of the attribute for this method annotation
        Method value = MyAnnotation.class.getMethod("value");
        System.out.println(value.getDefaultValue()); // the default value
    }

    @MyAnnotation(42)
    public static void method() {

    }
}

@Documented
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD)
@interface MyAnnotation {
    int value() default 1;
}

```

it prints

```
42
1

```