Solved

deprecated

Posted on 2001-06-17
3
425 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 50 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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.

757 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now