Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

what is the meaning of the deprecated in APIs

 
Krishna Latha Grandhi
Ranch Hand
Posts: 110
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Friends,


I am still in confusion about the word "deprecated".

Please give me explanation....

Regards,
Hari Krishna.
 
Ulf Dittmer
Rancher
Posts: 42969
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Deprecated means that the method or class in question should no lomger be used, because it has deficiencies. Sometimes these are functional (e.g. the Stream classes in the java.io package that do not handle I18N characters properly), sometimes something more powerful comes along (java.util.Date vs. java.util.Calendar), and sometimes something was ill though out to begin with (SingleThreadModel, various methods of Thread). Usually the javadocs suggest which methods/classes should be used instead.
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Simply don't use them. The Api tells you which method to call instead.
For example, Date's constructor

Date(int year, int month, int day)
Deprecated. instead use the constructor Date(long date)


So don't use this deprecated constructor, but the other one, Date(long date).
 
Alan Hermin
Ranch Hand
Posts: 290
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi friend...
depricated means that you can use the specified method/class ,BUT there is method/class that has enhancment features, and you can use the last one instead the depricated,,,,,
:roll:
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
From Java 5's @deprecated Annotation's API:

A program element annotated @Deprecated is one that programmers are discouraged from using, typically because it is dangerous, or because a better alternative exists. Compilers warn when a deprecated program element is used or overridden in non-deprecated code.
 
Sathish Nagappan
Ranch Hand
Posts: 76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Something like what the others have said. Deprecated means, that over the evolution of a new version of Java, the developers of the new version of Java have rolled out a new version of an existing function which either:

1. Offers more features
(And/or)
2. Is safer than the previous version.

However, in new versions of Java, support is still present for the deprecated functions. They are backward compatible. But do discourage you from using them, Sun has forced you to use the -deprecation tag each time you compile programs with deprecated API.

Hope this helps.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic