I am new to java and I am writing coding for automation in Selenium. I want to know is it possible to write a text file throughout the java program till end of the program. I have tried to write a text file using bufferedWriter.write()
. First three lines are writing and after that it is not at all writing any text. I have tried flush.
My question is,do we have possibility to open file at starting of the program and write lines when ever we need in the middle of the program and as many number of lines and close the file end of the program?
If possible, request to share any same code. I am fine with any file write method (File Writer, Buffered writer, file output stream)