I use the following code to write to a text file
String content = "I Love Java";
Files.write(Paths.get(gg), (content + "\n").getBytes(UTF_8),StandardOpenOption.CREATE,StandardOpenOption.APPEND);
After 3 consecutive times, the text is saved in the text as follows:
I Love JavaI Love JavaI Love Java
But, I want the text in the text file to look like this:
I Love Java
I Love Java
I Love Java
Any help please?
source
share