• Post Reply Bookmark Topic Watch Topic
  • New Topic

java uses or overrides a deprecated API.  RSS feed

 
Kasun Wixkramanayake
Ranch Hand
Posts: 74
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator



When i try to compile above program i get following error
Note: D:\myjava\K.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
please help me

 
Maneesh Godbole
Bartender
Posts: 11445
18
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Recompile with -Xlint:deprecation for details

So did you try recompiling with the flag as suggested?

Deprecated methods are methods whose usage is not recommended anymore. The API will give you an alternative.
 
Sathi Krishna
Ranch Hand
Posts: 51
Java
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The following method in java.io.DataInputStream has been deprecated because it does not properly convert bytes to characters.

Deprecated Method Alternative
String readLine() String BufferedReader.readLine()

For more info: Deprecated IO
 
Ulf Dittmer
Rancher
Posts: 42972
73
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you just intend to read text, then neither BufferedInputStream nor DataInputStream is appropriate. Use InputStreamReader and BufferedReader instead.

As an aside, I estimate that in 90% of the cases where I've seen people use DataInputStream, it is the wrong tool for the job.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!