overrides a deprecated API.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • raveendrabikkina
    New Member
    • Feb 2008
    • 26

    overrides a deprecated API.

    import java.io.*;

    class InputTest
    {
    public static void main(String []args) throws IOException
    {
    byte [] bytes = new byte[20];
    BufferedInputSt ream bis = new BufferedInputSt ream(System.in) ;
    DataInputStream dis = new DataInputStream (bis);
    String str = dis.readLine();

    DataOutputStrea m dos = new DataOutputStrea m(System.out);
    dos.writeUTF(st r.toUpperCase() );

    dos.close();

    System.out.prin tln("End of program"); // this willnot be printed

    }
    }
    This is the result when i try to complie this code help me out...!!!Java\jdk1.5.0\b in>javac InputTest.java


    Note: InputTest.java uses or overrides a deprecated API.
    Note: Recompile with -Xlint:deprecati on for details.
  • r035198x
    MVP
    • Sep 2006
    • 13225

    #2
    1.) Please use code tags next time when posting code.
    2.) You could do as the compiler says and recompile with -Xlint checked and see for yourself what the fuss is about.
    3.) Why don't you use java.util.Scann er for getting input from the console?

    Comment

    • raveendrabikkina
      New Member
      • Feb 2008
      • 26

      #3
      Originally posted by r035198x
      1.) Please use code tags next time when posting code.
      2.) You could do as the compiler says and recompile with -Xlint checked and see for yourself what the fuss is about.
      3.) Why don't you use java.util.Scann er for getting input from the console?
      thank you for your reply i'm just a beginer in java.i'm new to this community.i don't know the syntax for postings.

      Comment

      • raveendrabikkina
        New Member
        • Feb 2008
        • 26

        #4
        Originally posted by r035198x
        1.) Please use code tags next time when posting code.
        2.) You could do as the compiler says and recompile with -Xlint checked and see for yourself what the fuss is about.
        3.) Why don't you use java.util.Scann er for getting input from the console?
        what does this(Recompile with -Xlint:deprecati on for details.) mean how to recompile tat with -Xlint????

        Comment

        • r035198x
          MVP
          • Sep 2006
          • 13225

          #5
          Originally posted by raveendrabikkin a
          what does this(Recompile with -Xlint:deprecati on for details.) mean how to recompile tat with -Xlint????
          Just do
          Code:
          javac -Xlint YourClassName.java
          when compiling the class. You can then check the API to see what has now replaced that method.

          Comment

          • raveendrabikkina
            New Member
            • Feb 2008
            • 26

            #6
            Originally posted by r035198x
            Just do
            Code:
            javac -Xlint YourClassName.java
            when compiling the class. You can then check the API to see what has now replaced that method.
            javac: invalid flag: -Xlint
            Usage: javac <options> <source files>
            where possible options include:
            -g Generate all debugging info
            -g:none Generate no debugging info
            -g:{lines,vars,s ource} Generate only some debugging info
            -nowarn Generate no warnings
            -verbose Output messages about what the compiler is doing
            -deprecation Output source locations where deprecated APIs are us
            ed
            -classpath <path> Specify where to find user class files
            -sourcepath <path> Specify where to find input source files
            -bootclasspath <path> Override location of bootstrap class files
            -extdirs <dirs> Override location of installed extensions
            -d <directory> Specify where to place generated class files
            -encoding <encoding> Specify character encoding used by source files
            -source <release> Provide source compatibility with specified release
            -target <release> Generate class files for specific VM version
            -help Print a synopsis of standard options



            this is wat the message i'm getting.what to do??

            Comment

            • raveendrabikkina
              New Member
              • Feb 2008
              • 26

              #7
              ok if i use javac -deprecation myclassname.jav a this is what i'm getting now what is the solution for this?

              InputTest.java: 10: warning: readLine() in java.io.DataInp utStream has been depre
              cated
              String str = dis.readLine();
              ^
              1 warning

              Comment

              • r035198x
                MVP
                • Sep 2006
                • 13225

                #8
                Originally posted by raveendrabikkin a
                javac: invalid flag: -Xlint
                Usage: javac <options> <source files>
                where possible options include:
                -g Generate all debugging info
                -g:none Generate no debugging info
                -g:{lines,vars,s ource} Generate only some debugging info
                -nowarn Generate no warnings
                -verbose Output messages about what the compiler is doing
                -deprecation Output source locations where deprecated APIs are us
                ed
                -classpath <path> Specify where to find user class files
                -sourcepath <path> Specify where to find input source files
                -bootclasspath <path> Override location of bootstrap class files
                -extdirs <dirs> Override location of installed extensions
                -d <directory> Specify where to place generated class files
                -encoding <encoding> Specify character encoding used by source files
                -source <release> Provide source compatibility with specified release
                -target <release> Generate class files for specific VM version
                -help Print a synopsis of standard options



                this is wat the message i'm getting.what to do??
                What had you typed?

                Comment

                • raveendrabikkina
                  New Member
                  • Feb 2008
                  • 26

                  #9
                  Originally posted by r035198x
                  What had you typed?
                  Code:
                  javac -Xlint InputTest.java

                  Comment

                  • r035198x
                    MVP
                    • Sep 2006
                    • 13225

                    #10
                    Originally posted by raveendrabikkin a
                    ok if i use javac -deprecation myclassname.jav a this is what i'm getting now what is the solution for this?

                    InputTest.java: 10: warning: readLine() in java.io.DataInp utStream has been depre
                    cated
                    String str = dis.readLine();
                    ^
                    1 warning
                    Now read all my responses again.

                    Comment

                    • raveendrabikkina
                      New Member
                      • Feb 2008
                      • 26

                      #11
                      You could do as the compiler says and recompile with -Xlint checked and see for yourself what the fuss is about.

                      --->compiler said nothing
                      Why don't you use java.util.Scann er for getting input from the console?

                      how to use java.util.Scann er ???

                      Comment

                      • raveendrabikkina
                        New Member
                        • Feb 2008
                        • 26

                        #12
                        ok got the solution but i think this is because of the jdk version change...

                        thnq buddy

                        Comment

                        • r035198x
                          MVP
                          • Sep 2006
                          • 13225

                          #13
                          Originally posted by raveendrabikkin a
                          Y...>compiler said nothing
                          ..
                          The compiler told you the exact line number where the warning is and and even went as far as to give the exact method name that you used which is deprecated.


                          Originally posted by raveendrabikkin a
                          how to use java.util.Scann er ???
                          java.util.Scann er

                          P.S A warning is not the same as an error. The program compiles, creates the .class file and runs even if the compilation produced a warning.
                          P.PS The posting guidelines can be found here.
                          P.P.PS Welcome to TSDN.

                          Comment

                          Working...