Results 1 to 4 of 4
  1. #1
    j2vdk's Avatar
    j2vdk is offline Member
    Join Date
    Aug 2008
    Posts
    45
    Rep Power
    0

    Default note while compiling

    y im getting this note wen i compile the program

    F:\javademo\string input>javac stringip.java
    Note: stringip.java uses or overrides a deprecated API.
    Note: Recompile with -deprecation for details.


    but executing correctly,,,,,,,,

    code present in stringip.java is

    import java.io.*;
    class stringip{
    public static void main(String ar[]){
    try{
    DataInputStream ds=new DataInputStream(System.in);
    String a=ds.readLine();
    int d=Integer.parseInt(ds.readLine());
    System.out.println(a+d);
    }
    catch(Exception e)
    {
    System.out.println(e);
    }
    }

    }

  2. #2
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    16,589
    Rep Power
    23

    Default

    getting this note
    Recompile with -deprecation for details.
    Have you compiled with that option? If not you need to do so.
    You are using an old method that author of the class wants to get rid of.

  3. #3
    Supamagier is offline Senior Member
    Join Date
    Aug 2008
    Posts
    384
    Rep Power
    6

    Default

    You are using an old method that author of the class wants to get rid of.
    This means that the method can be removed from the java pack at any time, which will stop your program from working...
    I die a little on the inside...
    Every time I get shot.

  4. #4
    hardwired's Avatar
    hardwired is offline Senior Member
    Join Date
    Jul 2007
    Posts
    1,576
    Rep Power
    8

    Default

    This is how you handle compiler deprecation warnings:
    Java Code:
    C:\jexp>javac stringip.java
    Note: stringip.java uses or overrides a deprecated API.
    Note: Recompile with -Xlint:deprecation for details.
    
    C:\jexp>javac -Xlint:deprecation stringip.java
    stringip.java:7: warning: [deprecation] readLine() in java.io.DataInputStream 
    has been deprecated
                String a=ds.readLine();
                           ^
    stringip.java:8: warning: [deprecation] readLine() in java.io.DataInputStream 
    has been deprecated
                int d=Integer.parseInt(ds.readLine());
                                         ^
    2 warnings
    
    C:\jexp>
    Look up the readLine method in the DataInputStream class to see what its use has been replaced with.

Similar Threads

  1. compiling trouble
    By capacitator in forum CLDC and MIDP
    Replies: 4
    Last Post: 06-10-2008, 10:12 PM
  2. I have 3 errors after compiling
    By coco in forum JDBC
    Replies: 2
    Last Post: 10-18-2007, 09:32 AM
  3. Error during compiling
    By boy22 in forum New To Java
    Replies: 2
    Last Post: 08-03-2007, 02:42 AM
  4. problems when compiling
    By valery in forum New To Java
    Replies: 2
    Last Post: 07-25-2007, 07:35 PM
  5. Error while compiling
    By ai_2007 in forum Advanced Java
    Replies: 1
    Last Post: 07-01-2007, 11:37 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •