0 votes
in JAVA by
How to read a file in java?

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);

  }

}

Related questions

0 votes
asked May 2, 2021 in JAVA by sharadyadav1986
0 votes
asked Nov 14, 2020 in JAVA by rajeshsharma
...