Java Deprecation

Java Deprecation


What is Java deprecation and why it is necessary in a programming language, say, Java?

Java Deprecation: 1. A method introduced in one version of Java may become outdated in the next version as next version method is a better method than the old version method. We call old version method is obsolete. The obsolete methods are known as deprecated methods.

Example:

JDK 1.0 Date class methods, like getMonth() etc, are deprecated. In JDK 1.1, the Date class is replaced by Calendar and GregorianCalendar.

Java Deprecation: 2. When a product is developed, the Testing Engineer tests with different test cases and if okayed, the product is released to market. But in market, different clients use for different purposes with different test cases. Some programmer found the method is not working in certain test case and company which developed found the complaint very correct. Then the company deprecates the method in the next version.

Example:

readLine() method of DataInputStream (JDK 1.0) is deprecated in favour of readLine() of BufferedReader (JDK 1.1). That is readLine() method DataInputStream is deprecated but the readLine() method of BufferedReader is not deprecated. The problem with readLine() method of DataInputStream is rectified in the readLine() method of BufferedReader. Moreover, newLine() method is added in BufferedReader.

Following links of this same Web site give more information on Java Deprecation with programming.

1. Deprecation – Meaning

2. Java Standard Annotations (@Deprected) or how to deprecate a method?

Leave a Reply

Your email address will not be published. Required fields are marked *