Solved

deprecated

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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
web services creation SOAP vs REST 5 56
ejb stateless example 2 18
What's wrong with this code? 4 25
How  can  i  resolve  HTTP Status 404 -? 8 41
For customizing the look of your lightweight component and making it look lucid like it was made of glass. Or: how to make your component more Apple-ish ;) This tip assumes your component to be of rectangular shape and completely opaque. (COD…
Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
Viewers learn about the “while” loop and how to utilize it correctly in Java. Additionally, viewers begin exploring how to include conditional statements within a while loop and avoid an endless loop. Define While Loop: Basic Example: Explanatio…
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.

792 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