MCPcopy Create free account
hub / github.com/ShivaBhattacharjee/KeyZen / FileIoDemo

Class FileIoDemo

data/java/08_file_io.java:6–20  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4import java.util.List;
5
6class FileIoDemo {
7 public static void main(String[] args) throws IOException {
8 Path path = Path.of("scores.txt");
9
10 List<String> lines = List.of("Ava,82", "Leo,77", "Mia,91");
11 Files.write(path, lines);
12
13 List<String> readBack = Files.readAllLines(path);
14 for (String line : readBack) {
15 System.out.println(line);
16 }
17
18 Files.deleteIfExists(path);
19 }
20}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected