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  ww . j av  a  2 s. 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.





















Home »
  Java Tutorial »
    java.net »




CookieManager
CookiePolicy
CookieStore
DatagramPacket
DatagramSocket
HttpCookie
HttpURLConnection
InetAddress
JarURLConnection
MulticastSocket
ServerSocket
Socket
SocketAddress
URI
URL
URLConnection
URLDecoder
URLEncoder