How do you just the @Deprecated annotation?

John Zukowski

You place the @Deprecated annotation above the method or class you want to flag as out of date. You can still use the @deprecated javadoc tag to say why something is deprecated:

public class Dep {
  /**
   * @deprecated Don't use this method any more.
   */
  @Deprecated
  public static void myDeprecatedMethod() {
     System.out.println("Why did you do that?");
  }
}
class DeprecatedUsage {
  public void useDeprecatedMethod() {
    Dep.myDeprecatedMethod();
  }
}
0 Comments  (click to add your comment)
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

About | Sitemap | Contact