Print all lines in the file: File f = new File("C:\\eclipse-workspace\\LearningJava\\src\\com\\javalearning\\properties\\TestData1.txt"); FileReader fr = new FileReader(f); BufferedReader br = new BufferedReader(fr); // 1).find out file's line #: Files.lines(path,StandardCharsets.UTF_8) long lines; try (Stream stream = Files.lines(f.toPath(), StandardCharsets.UTF_8)) { lines = stream.count(); } System.out.println("Line # "+lines); // 2).Print out all lines: int i=0; while(i
Thank you!!!
without using flush() method , the contents of the buffer are not getting written to file. is it mandatory to use flush()
great
Print all lines in the file:
File f = new File("C:\\eclipse-workspace\\LearningJava\\src\\com\\javalearning\\properties\\TestData1.txt");
FileReader fr = new FileReader(f);
BufferedReader br = new BufferedReader(fr);
// 1).find out file's line #: Files.lines(path,StandardCharsets.UTF_8)
long lines;
try (Stream stream = Files.lines(f.toPath(), StandardCharsets.UTF_8)) {
lines = stream.count();
}
System.out.println("Line # "+lines);
// 2).Print out all lines:
int i=0;
while(i
thank you so much for this
thank u
How to verify particular cell in the text file for example [1][3] first row third column?