URL toString Example

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


URL class toString example. public String toString() Constructs a string representation of this URL. The string is created by calling the toExternalForm method of the stream protocol handler for this object.

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

import java.net.*;
import java.io.*;

public class ToString {

    public static void main(String[] argsthrows Exception {

        URL url = new URL("http://google.com");
        System.out.println(url.toString());
    }
}

Output
http://google.com

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

HOME | COPYRIGHT | CONTACT US