• Post Reply Bookmark Topic Watch Topic
  • New Topic

deprecated method  RSS feed

 
Arun Prasath
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
can deprecated methods be used in java?
what will happen , if i used?
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
They can be used, but you'll get a compiler warning.
They should not be used, because they can be removed any time.
 
Sanjaya Sugiarto
Ranch Hand
Posts: 229
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The deprecated methods are considered as "legacy" methods. More: http://java.sun.com/j2se/1.5.0/docs/guide/javadoc/deprecation/deprecation.html

The deprecated methods can indeed be removed in any time, but the chance to be removed is very small (e.g something huge like standard java library), in order to maintain backward compatibility. It is very useful if you code for a client whose branch offices run different versions of Java (one may have the Java 5, other perhaps Java 1.2, and so on). For optimal performance, etc you shouldn't use the deprecated methods though.
 
Campbell Ritchie
Marshal
Posts: 56553
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There are three grades of being "out-of-date."
  • There are a few deprecated methods which are deprecated because they don't work. Thread.stop() and Thread.suspend() have major flaws and must never be used.
  • There are many deprecated methods and classes because something better has been invented. Look up the API and click "deprecated" and see what it says. Using deprecated coding risks missing the use of something better. But most deprecated coding still works.
  • There are classes which programmers know have been replaced by newer classes. Most people use ArrayList instead of Vector and HashMap instead of HashTable, but the older classes are still available, not deprecated.
  • I think Sun keep all the old coding available, otherwise legacy software would become impossible to use.
     
    Christophe Verré
    Sheriff
    Posts: 14691
    16
    Eclipse IDE Ubuntu VI Editor
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    because they can be removed any time.

    Sorry about that guys, that was crap
    Thanks for pointing it out.
     
    Stan James
    (instanceof Sidekick)
    Ranch Hand
    Posts: 8791
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Sun Creates Feature Removal Process ...
     
    Consider Paul's rocket mass heater.
    • Post Reply Bookmark Topic Watch Topic
    • New Topic
    Boost this thread!