Link to home
Start Free TrialLog in
Avatar of salasadi
salasadi

asked on

cannot get rid of the message Java Deprecated Class

I have simple class to read from text file.  the clas work ok, but the "deprecation" warrning is bugging me :(

C:\>javac FileInput.java -Xlint
FileInput.java:29: warning: [deprecation] readLine() in java.io.DataInputStream
has been deprecated
        System.out.println(dis.readLine());
                              ^
1 warning

C:\>javac FileInput.java
Note: FileInput.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.

here is the class:
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;

public class FileInput {

  public static void main(String[] args) {
    File file = new File("C:\\que.sql");    
    try {
      fis = new File(file);
        
        BufferedReader in = new BufferedReader(new InputStreamReader(fis));
                
      while (in.available() != 0) {

     
        System.out.println(in.readLine());
      }

      fis.close();
     
    } catch (FileNotFoundException e) {
      e.printStackTrace();
    } catch (IOException e) {
      e.printStackTrace();
    }
  }
}
ASKER CERTIFIED SOLUTION
Avatar of CEHJ
CEHJ
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial