Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

compiling problem

Status
Not open for further replies.

hada

Programmer
Jul 1, 2003
4
MY
when i compile my file, it appears like that :

Note : file.java uses or overrides a deprecated API
Note : Recompile with -deprecation for details

i want to know why it appears like that?
 
you might be using a deprecated API or reserved word 'assert' with java 1.4. to tell java to compile with
jdk 1.3, check out:-

thread269-567984

~za~
You can't bring back a dead thread!
 
When you don't want users to use a certain method anymore you can mark it "deprecated" so that they get a warning when they compile a program that uses this method. This is only a warning. (instead of removing your deprecated method, which would give a compilation error in the calling pgm).
You can test this for yourself by compiling the following examples :
The first example "Test.java" contains a deprecated method "doIt()".
The second example "TestDeprecated.java" uses this deprecated method.
Compiling "TestDeprecated.java" gives :

D:\test>javac TestDeprecated.java
Note: TestDeprecated.java uses or overrides a deprecated API.
Note: Recompile with -deprecation for details.

D:\test>javac -deprecation TestDeprecated.java
TestDeprecated.java:8: warning: doIt() in Test has been deprecated
test.doIt();
^
1 warning

D:\test>

=== Test.java ===
Code:
public class Test {

  public Test() {
  }

  /**
   * @deprecated
   */ 			
  public void doIt() {
    System.out.println("Executing Test.doIt()");
  }

  public static void main(String args[]) {
    Test test = new Test();
    test.doIt();
  }

}

=== TestDeprecated.java ===
Code:
public class TestDeprecated {

  public TestDeprecated () {
  }

  public static void main(String args[]) {
    Test test = new Test();
    test.doIt();
  }

}
==================================
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top