Win a copy of OCP Java SE 8 Programmer II Exam Study Guide this week in the OCP forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

java uses or overrides a deprecated API.  RSS feed

 
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

 
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.
 
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
 
Rancher
Posts: 42975
76
  • 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!