Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

deprecated API

 
Trupti brane
Greenhorn
Posts: 20
C++ Java Windows Vista
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
after compiling my program i am getting

Note: invest.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.

after recompiling it with -deprecation flag
i am getting following warning :
readLine() in java.io.DataInputStream has been deprected




following is my code :
 
Maneesh Godbole
Saloon Keeper
Posts: 11021
12
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Trupti brane wrote:
after recompiling it with -deprecation flag
i am getting following warning :
readLine() in java.io.DataInputStream has been deprected

The API docs are your friend. Check them out to understand why this method is deprecated and a suggested workaround.
 
Trupti brane
Greenhorn
Posts: 20
C++ Java Windows Vista
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
got the answer

readLine()
Deprecated. This method does not properly convert bytes to characters. As of JDK 1.1, the preferred way to read lines of text is via the BufferedReader.readLine() method. Programs that use the DataInputStream class to read lines can be converted to use the BufferedReader class by replacing code of the form:

DataInputStream d = new DataInputStream(in);


with:

BufferedReader d
= new BufferedReader(new InputStreamReader(in));
 
Trupti brane
Greenhorn
Posts: 20
C++ Java Windows Vista
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
new code with changes

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic