Java API Tutorial - Java URI.resolve(URI uri)








Syntax

URI.resolve(URI uri) has the following syntax.

public URI resolve(URI uri)

Example

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

import java.net.URI;
import java.net.URISyntaxException;
//  w w w  . j  a v  a  2s  . c o  m

public class Main {

  public static void main(String[] args) throws URISyntaxException {
    URI uri = new URI("/abc.htm");
    uri.resolve(new URI("http://java2s.com/../xyz/abc.htm"));
    System.out.println(uri);
  }
}

The code above generates the following result.