← Winnitude! Search  ·  Reader Mode (1784 ms)
Links: Stay in Reader Retro Site Converter Retro Mode: OFF Original Page ↗
GITHUB · 6 LINKS

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, 2026

In 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions