Deprecate Old APIs

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

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist