URI GetFragment() Example

Returns the decoded fragment component of this URI.


URIclass GetFragment() method example. This example shows you how to use GetFragment() method.This method Returns the decoded fragment component of this URI.

Here is the code:-

/**
 * @Program that Returns the decoded fragment component of this URI.
 * GetFragment.java 
 * Author:-RoseIndia Team
 * Date:-24-jun-2008
 */
import java.net.*;

public class GetFragment {

    public static void main(String[] argsthrows Exception {
        String scheme = "http";
        String userInfo = "girish";
        String host = "tewari.com";
        int port = -1;
        String path = "/mail/";
        String query = "open";
        String fragment = "inbox";
        URI uri = new URI(scheme,userInfo, host,port, path,query, fragment);
        System.out.println("Given uri is: "+uri);
        //Returns the decoded fragment component of this URI.
        System.out.println("Fragment component of this URI is:"+uri.getFragment());
         
    }
}

Output of the program:-
 Given uri is: http://girish@tewari.com/mail/?open#inbox
Fragment component of this URI is:inbox

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

HOME | COPYRIGHT | CONTACT US