• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

what is the meaning of the deprecated in APIs

 
Ranch Hand
Posts: 110
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Friends,


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

Please give me explanation....

Regards,
Hari Krishna.
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Sheriff
Posts: 14691
16
Eclipse IDE VI Editor Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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).
 
Ranch Hand
Posts: 290
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 VI Editor Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 76
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Note to self: don't get into a fist fight with a cactus. Command this tiny ad to do it:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic