URL sameFile Example

URL class sameFile example. This example shows you how to use sameFile method.


URL class sameFile example. public boolean sameFile(URL other) Compares two URLs, excluding the fragment component. Returns true if this URL and the other argument are equal without taking the fragment component into consideration.

Here is the code
/*
 * @ # SameFile.java
 * A class repersenting use to sameFile method 
 * of URL class in java.net package
 * version 24 June 2008
 * author Rose India 
 */

import java.net.*;

public class SameFile {

    public static void main(String[] argsthrows Exception {

        URL url1 = new URL("http://google.com");
        URL url2 = new URL("http://google.com");

        System.out.println(url1.sameFile(url2));
    }
}

Output
true

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

HOME | COPYRIGHT | CONTACT US