This week's book giveaway is in the OCPJP forum.
We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes deprecated API Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "deprecated API" Watch "deprecated API" New topic
Author

deprecated API

Trupti brane
Greenhorn

Joined: Aug 16, 2011
Posts: 20

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

Joined: Jul 26, 2007
Posts: 10491
    
    9

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.


[How to ask questions] [Donate a pint, save a life!] [Onff-turn it on!]
Trupti brane
Greenhorn

Joined: Aug 16, 2011
Posts: 20

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

Joined: Aug 16, 2011
Posts: 20

new code with changes

 
jQuery in Action, 2nd edition
 
subject: deprecated API