title: Java Standard Annotations
body: <p>I have recently started reading into annotations. I deprecated the armStrong() method here and I need to suppress the deprecation warning but wherever I put it it says "unnecessary @SuppressWarnings("deprecation")".</p>
  
  <p>Can anyone tell me where to place it so that the <code>method is deprecated</code> warning would not come anymore?    </p>
  
  <pre><code>import java.io.*;
  import java.lang.annotation.*;
  import java.lang.reflect.Method;
  
  @Retention(RetentionPolicy.RUNTIME)
  
  @interface number
  {
  String arm();
  }
  
  public class Ch10LU2Ex4
  {  
  @Deprecated
  @number(arm = "Armstrong number")
  public static void armStrong(int n)
   {
      int temp, x, sum = 0;
      temp = n;
      while(temp!=0)
       {
          x = temp%10;
          sum = sum+x*x*x;
          temp = temp/10;
       }
      if(sum==n)
       {
          System.out.println("It is an armstrong number");
       }
      else
      {
          System.out.println("It is not an armstrong number");
      }
   }
  
  public static void main(String[] args) 
    {
  
      try
      {   
          Ch10LU2Ex4 obj = new Ch10LU2Ex4();
          obj.invokeDeprecatedMethod();
          Method method = obj.getClass().getMethod("armStrong", Integer.TYPE);
          Annotation[] annos = method.getAnnotations();
          for(int i = 0; i&lt;annos.length; i++)
          {
              System.out.println(annos[i]);
          }
      }
      catch(Exception e)
       {
          e.printStackTrace();
       }
    } 
      @SuppressWarnings("deprecation")
      public void invokeDeprecatedMethod()
      {
          try
          {
          System.out.println("Enter a number between 100 and 999:");
          BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
          int x = Integer.parseInt(br.readLine());
          Ch10LU2Ex4.armStrong(x);
          }
          catch(IOException e)
          {
              e.printStackTrace();
          }
      }
    }  
  </code></pre>