new line in java text file code example Example: java filewriter new line fileWriter.write(System.lineSeparator());