• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

deprecated method

 
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
can deprecated methods be used in java?
what will happen , if i used?
 
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
They can be used, but you'll get a compiler warning.
They should not be used, because they can be removed any time.
 
Ranch Hand
Posts: 229
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Marshal
Posts: 79177
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 VI Editor Ubuntu
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator

    because they can be removed any time.


    Sorry about that guys, that was crap
    Thanks for pointing it out.
     
    (instanceof Sidekick)
    Posts: 8791
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Sun Creates Feature Removal Process ...
     
    reply
      Bookmark Topic Watch Topic
    • New Topic