/** Deprecating a method using the annotation. @author J. Benton */
public class DeprecateExample {
  // if you use this method, you'll get a warning that it is deprecated.
  @Deprecated
  public void ohNoIAmDeprecated() {
     System.out.println("I am deprecated!");
  }
}

Example 1: Deprecating a method using annotation.

Back to Article