The NIO.2 API in java.nio.file represents a location in a file system with the Path interface. You create one with Path.of("data", "logs", "app.log") or the older equivalent Paths.get(...). Creating a Path does not touch the disk: the file does not need to exist, and most Path methods are pure string manipulation. An absolute path starts from a root, such as / on Linux or C:\ on Windows; a relative path is interpreted against the current working directory.
Keep reading for free
Create a free StudyToCert account to read the rest of this lesson: 5 more sections, 5 key terms, a real-world example, an exam tip and self-check questions. Every lesson, lab and practice test is free with an account.