?
Solved

deprecated

Posted on 2001-06-17
3
Medium Priority
?
434 Views
Last Modified: 2010-03-31
Hi,

i searched questions in EE for "deprecated" but did not find something.

Ok, my question is : how to solve a xxx.java with "deprecated" error message, when compiling ?

i am using JDK1.1.2, and a book says "deprecated" means obsolete code. Maybe i just download JDK1.1.0 ?

Thanks for any comments.
0
Comment
Question by:collinng
  • 2
3 Comments
 
LVL 15

Accepted Solution

by:
ozymandias earned 200 total points
ID: 6200278
You will always get deprecated messages when compiling if you have used deprecated methods in your code.

They are warnings, not errors. It is generally safe to ignore them. Your code will still compile and run fine, but you need to bear in mind that at some point it will need updating.

If a method has been deprecated it is usually becuase it has been replaced by a new "better" method. Eventually that old method will be removed from the class at which point you will get real compile errors.

The best thing to do is check the Java API documentation for the class that has the deprecated method. This can be downloaded from http://java.sun.com. The description of the deprecated method will very often tell you what the new "recommended" method to the replace it is.
0
 
LVL 15

Expert Comment

by:ozymandias
ID: 6200281
A list of all deprecated classes, interfaces, exceptions, fields, methods and constructors comes with the Java API Documentation.

Here is an example :

The class java.awt.List has a deprecated method clear().
In the documentation the method is marked as deprecated and the following comment is shown :

  Deprecated. As of JDK version 1.1, replaced by removeAll().

This means that while you can use the clear method for the time being, it is recommended that you use the removeAll() method in future.
0
 
LVL 3

Expert Comment

by:shyamkumarreddy
ID: 6200976
Hi Collinng
When compiling. if u see depracated.

It is just a warning. that these methods are no more available in the current version of java. U need to change your method to the current available one.

Please recompile with -depreciation. It will list u all the methods need to be changed.

And refer to the documentation for the newer ones

Shyam
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
The viewer will learn how to implement Singleton Design Pattern in Java.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
Suggested Courses
Course of the Month17 days, 10 hours left to enroll

831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question