This week's book giveaway is in the Other Languages forum.
We're giving away four copies of Rust Web Development and have Bastian Gruber on-line!
See this thread for details.
Win a copy of Rust Web Development this week in the Other Languages forum!
  • 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:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

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: 74643
335
  • 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 ...
     
    You showed up just in time for the waffles! And this tiny ad:
    Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
    https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    reply
      Bookmark Topic Watch Topic
    • New Topic