Example code in File Systems Basics tutorial needs a try block · Issue #266 · java/devjava-content
Repository navigation
Example code in File Systems Basics tutorial needs a try block #266
New issue
New issue
Open
Open
Example code in File Systems Basics tutorial needs a try block #266
Description
@authentictech's profile authentictech opened on Jul 30, 2026In Learn > The Java I/O API > File System Basics > Manipulating Files and Directories, section "Checking Whether Two Paths Locate the Same File" the code below needs a try block as it throws IOException.
if (Files.isSameFile(p1, p2)) {
// Logic when the paths locate the same file
}
Possibly trivial, as it's small and incomplete code example, but it might still aid understanding to know that is required. I also expanded the code example to try some things out, which others may also do, so would save a bit of time to include upfront.
Thanks.