feat: complete all files

This commit is contained in:
2026-05-15 17:30:41 +03:30
parent 42f07c638d
commit 51cccccea4
9 changed files with 61 additions and 93 deletions
@@ -11,28 +11,16 @@ import java.util.List;
public class WriteFileExample02 {
static void main() {
List<String> lines = List.of(
"Line 1",
"Line 2"
);
Path path = Path.of("examples2.txt");
try {
Path path = Path.of("quotes.txt");
List<String> lines = List.of(
"I'm not superstitious, but I am a little stitious.",
"I am running away from my responsibilities. And it feels good."
);
Files.write(path, lines);
} catch (IOException e) {
throw new RuntimeException(e);
}
try {
Path path = Path.of("quotes.txt");
List<String> lines = List.of(
"I DECLARE BANKRUPTCY!"
);
Files.write(path, lines, StandardOpenOption.APPEND);
} catch (IOException e) {
throw new RuntimeException(e);
System.err.println(e.getMessage());
}
}
}