Java IO Tutorial - Java Paths.get(URI uri)








Syntax

Paths.get(URI uri) has the following syntax.

public static Path get(URI uri)

Example

In the following code shows how to use Paths.get(URI uri) method.

import java.net.URI;
import java.nio.file.Path;
import java.nio.file.Paths;
//from w w  w. ja va2s.c o m
public class Main {

  public static void main(String[] args) {

    Path path = Paths.get(URI.create("file:///tutorial/Java/JavaFX/Topic.txt"));
    System.out.println(path);

    path = Paths.get(URI.create("file:///C:/tutorial/Java/JavaFX/Topic.txt"));
    System.out.println(path);

  }
}

The code above generates the following result.