URL getProtocol Example

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


URL class getProtocol example. public String getProtocol() Gets the protocol name of this URL.

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

import java.net.*;

public class GetProtocol {

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

        URL url = new URL("http://java.sun.com/javase/6/docs/api/");

        System.out.println("Protocol " + url.getProtocol());
    }
}

Output
Protocol http

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

HOME | COPYRIGHT | CONTACT US