URL getQuery Example

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


URL class getQuery example. public String getQuery() Gets the query part of this URL.

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

import java.net.*;

public class GetQuery {

    public static void main(String args[]) throws Exception {

        URL url = new URL("http://java.sun.com?login=true");

        System.out.println(url.getQuery());
    }
}

Output
login=true

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

HOME | COPYRIGHT | CONTACT US