Solved

deprecated

Posted on 2001-06-17
3
430 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

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 first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.

724 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