title: Java Annotations not working
body: <p>I'm trying to use Java annotations, but can't seem to get my code to recognize that one exists. 
  What am I doing wrong? </p>
  
  <pre><code>  import java.lang.reflect.*;
    import java.lang.annotation.*;
  
    @interface MyAnnotation{}
  
  
    public class FooTest
    { 
      @MyAnnotation
      public void doFoo()
      {       
      }
  
      public static void main(String[] args) throws Exception
      {               
          Method method = FooTest.class.getMethod( "doFoo" );
  
          Annotation[] annotations = method.getAnnotations();
          for( Annotation annotation : method.getAnnotations() )
              System.out.println( "Annotation: " + annotation  );
  
      }
    }
  </code></pre>