try (Stream<String> stream = Files.lines(Paths.get(fileName))) { stream.forEach(System.out::println); } String text = "Text to save to file"; Files.write(Paths.get("./fileName.txt"), text.getBytes());
try (Stream<String> stream = Files.lines(Paths.get(fileName))) { stream.forEach(System.out::println); } String text = "Text to save to file"; Files.write(Paths.get("./fileName.txt"), text.getBytes());