0 votes

1 Answer

0 votes
by
How to read a file in java?

import java.io.*;

public class Read

{

  public static void main(String[] args)throws Exception

  {

  File file = new File(""C:\\Users\\LBL\\Desktop\\test.txt"");

  

  BufferedReader br = new BufferedReader(new FileReader(file));

  

  String st;

  while ((st = br.readLine()) != null)

    System.out.println(st);

  }

}
...