Java Path.normalize()

Syntax

Path.normalize() has the following syntax.

Path normalize()

Example

In the following code shows how to use Path.normalize() method.


//from   ww w . j  a v a2 s.c om
import java.nio.file.Path;
import java.nio.file.Paths;

public class Main {

  public static void main(String[] args) {
     Path path = Paths.get("C:/home/./music/users.txt");
     System.out.println("Normalized: " + path.normalize());

  }
}

The code above generates the following result.





















Home »
  Java Tutorial »
    java.nio.file »




DirectoryStream.Filter
Files
FileStore
FileSystem
FileVisitor
Path
Paths
WatchService