java.nio.file · java.base · since Java 1.7

Path

declaration
public interface Path extends Comparable<Path>, Iterable<Path>, Watchable

An immutable filesystem location with path algebra: resolve (join), relativize (invert), normalize (clean). The modern replacement for File's path half.

Key methods

static Path of(String first, String... more)Create from segments.
Path resolve(String other)Join paths.
Path relativize(Path other)The inverse: this → other as a relative path.
Path normalize()Remove . and .. segments.
Path getParent() / getFileName()Structural accessors.