A lot of threads talking about what deprecated means but not what it means for a method. Could someone please explain?
-
4Why would "Old, don't use" many any different for a method than for a class? – Andrew Thompson Feb 26 '13 at 04:55
6 Answers
According to the Java Documentation:
A program element annotated @Deprecated is one that programmers are discouraged from using, typically because it is dangerous, or because a better alternative exists.
Basically, you can still use it but there is a safer & better way to do it now.
This means that the author wants to remove this method, but didn't do this yet to not break backward compatibility. This also means, that you should not use this method, and if your are already using it, you should stop using it.
The method could be marked as deprecated because another method exists that supersedes functionality of this method, or because method is unsafe or some other reason.

- 626
- 12
- 28

- 13,572
- 1
- 38
- 40
It means that the author of the code intends that you shouldn't use that method anymore. It's a way of notifying people that it may be going away in the future without just ripping it out from under them.

- 1,660
- 11
- 13
It means that you are not supposed to use it anymore. It is supported currently but might be deleted in future releases of Java. Normally docs specify which methods to use instead.

- 9,467
- 12
- 55
- 101
Deprecated methods are methods that used to be supported and safe to use, but no longer are safe to use. They can be unsafe to use for a multitude of reasons. The methods may or may not work the way you want.
Here's a link giving a better explanation: http://mindprod.com/jgloss/deprecated.html
In short: don't use them if you can avoid it

- 7,017
- 9
- 37
- 55
A deprecated class or method is like that. It is no longer important. It is so unimportant, in fact, that you should no longer use it, since it has been superseded and may cease to exist in the future.
Check this: How and When To Deprecate APIs

- 13,752
- 1
- 36
- 71