URL getAuthority Example

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


URL class getAuthority example. public String getAuthority() Gets the authority part of this URL.

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

import java.net.*;

public class GetAuthority {

    public static void main(String[] argsthrows Exception{

        URL url = new URL("http://localhost:8080/programs/");
        System.out.println(url.getAuthority());
    }
}

Output
localhost:8080

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

HOME | COPYRIGHT | CONTACT US