Deprecate Old APIs

When you write a new version of an API, you want to deprecate the old API. If you deprecate old API’s, the compiler will tell you wherever that deprecated API is being used. SUN uses this practice to slowly eliminate older APIs.

To deprecate a method, write the following javadoc comment above the method.

/** * @deprecated This method is being deprecated from next version */public void m1(){   XXXX}

To enable deprecation messages, compile sources with the deprecation option:

javac -deprecation
Share the Post:
Share on facebook
Share on twitter
Share on linkedin

More From DevX