Browse DevX
Sign up for e-mail newsletters from DevX

Tip of the Day
Language: Java Language
Expertise: Beginner
Dec 23, 1997



Building the Right Environment to Support AI, Machine Learning and Deep Learning

Deprecated API

When I compile my applets or applications, the compiler often tells me I'd use a "deprecated API" and that I should recompile with the option "-deprecate". If I do so, the warning does not appear any more, but I haven't noticed a difference in the behavior of the applications and applets, respectively. What does it mean when the compiler warns me that I have a "deprecated API"?

A deprecated API is a set of methods or classes that have either been superseded by new ones or that have simply been discontinued. Deprecated API's may or may not be supported in future versions of Java, but will most likely be phased out. The compiler warns you about the deprecation so that you may gradually update your code to use new API's. Otherwise your code may not work with a future version of Java that completely eliminates the deprecated API's.

The idea behind deprecating an API is to give programmers a chance to update their code rather than catch them off guard and force them to do so immediately. Although we have yet to see how Sun is going to handle deprecation, the implication is that when an API is to be discontinued it will first become deprecated. Then in the next major release after deprecation it will be completely eliminated.

DevX Pro
Comment and Contribute






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



Thanks for your registration, follow us on our social networks to keep up-to-date