469,287 Members | 2,731 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,287 developers. It's quick & easy.

overrides a deprecated API.

raveendrabikkina
import java.io.*;

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

DataOutputStream dos = new DataOutputStream(System.out);
dos.writeUTF(str.toUpperCase());

dos.close();

System.out.println("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\bin>javac InputTest.java


Note: InputTest.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Feb 22 '08 #1
12 19999
r035198x
13,262 8TB
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.Scanner for getting input from the console?
Feb 22 '08 #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.Scanner 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.
Feb 22 '08 #3
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.Scanner for getting input from the console?
what does this(Recompile with -Xlint:deprecation for details.) mean how to recompile tat with -Xlint????
Feb 22 '08 #4
r035198x
13,262 8TB
what does this(Recompile with -Xlint:deprecation for details.) mean how to recompile tat with -Xlint????
Just do
Expand|Select|Wrap|Line Numbers
  1. javac -Xlint YourClassName.java
when compiling the class. You can then check the API to see what has now replaced that method.
Feb 22 '08 #5
Just do
Expand|Select|Wrap|Line Numbers
  1. 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,source} 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??
Feb 22 '08 #6
ok if i use javac -deprecation myclassname.java this is what i'm getting now what is the solution for this?

InputTest.java:10: warning: readLine() in java.io.DataInputStream has been depre
cated
String str = dis.readLine();
^
1 warning
Feb 22 '08 #7
r035198x
13,262 8TB
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,source} 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?
Feb 22 '08 #8
What had you typed?
Expand|Select|Wrap|Line Numbers
  1. javac -Xlint InputTest.java
Feb 22 '08 #9
r035198x
13,262 8TB
ok if i use javac -deprecation myclassname.java this is what i'm getting now what is the solution for this?

InputTest.java:10: warning: readLine() in java.io.DataInputStream has been depre
cated
String str = dis.readLine();
^
1 warning
Now read all my responses again.
Feb 22 '08 #10
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.Scanner for getting input from the console?

how to use java.util.Scanner ???
Feb 22 '08 #11
ok got the solution but i think this is because of the jdk version change...

thnq buddy
Feb 22 '08 #12
r035198x
13,262 8TB
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.


how to use java.util.Scanner ???
java.util.Scanner

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.
Feb 22 '08 #13

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

3 posts views Thread by ECVerify.com | last post: by
4 posts views Thread by Christopher W. Douglas | last post: by
45 posts views Thread by Matt Parkins | last post: by
3 posts views Thread by Ben Rush | last post: by
10 posts views Thread by Atif | last post: by
2 posts views Thread by Kalvin | last post: by
1 post views Thread by =?Utf-8?B?QnJldHRWUA==?= | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.