Type a Path.of and Files.readString call
Type a Path.of and Files.readString call
Answer
Path p = Path.of("config.txt"); String s = Files.readString(p, StandardCharsets.UTF_8);
readString (Java 11+) reads the entire file in one call. Path.of is the modern replacement for new File() — it does not touch the file system, it just builds a path object.