Answers for "fileReader java how to read strings"

1

read Text Files in Java with BufferedReader

import java.io.*;

public class FileReaderWithBufferedReader {

    public static void main(String[] args) throws IOException{We
        String file = "src/file.txt";
        BufferedReader bufferedReader = new BufferedReader(new FileReader(file));

        String curLine;
        while ((curLine = bufferedReader.readLine()) != null){
            //process the line as required
            System.out.println(curLine);
        }
        bufferedReader.close();
    }
}
Posted by: Guest on September-14-2021
5

java read file bufferedreader

try {
	File file = new File("data.txt");
	BufferedReader reader = new BufferedReader(new FileReader(file));
	String line;

	while((line = reader.readLine()) != null) {
	 	 System.out.println(line);
	}
} catch(IOException e) {
  	e.printStackTrace();
}
Posted by: Guest on June-22-2020

Code answers related to "fileReader java how to read strings"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language