URI compareTo() Example

Compares this URI to another object, which must be a URI.


URIclass compareTo() method example. This example shows you how to use compareTo() method.This method Compares this URI to another object, which must be a URI.

Here is the code:-

/**
 * @Program that Compares this URI to another object, which must be a URI.
 * CompareTo.java 
 * Author:-RoseIndia Team
 * Date:-23-jun-2008
 */
import java.net.*;

public class CompareTo {

    public static void main(String[] argsthrows Exception {
        URI u = new URI("http://java.sun.com/j2se/1.3");
        //Compares this URI to another object, which must be a URI.
        int i = u.compareTo(new URI("http://java.sun.com/j2se/1.3"));
        System.out.println(i);
    }
}

Output of the program:-
 0

Post Comment
Name:
E-mail:
Contact no :
Comments:
  Refresh Image
Verify Image:
 
 
Your Comment's
 
 
 

HOME | COPYRIGHT | CONTACT US