Java URL toString() Method

The toString() method of URL class constructs a string representation of this URL. The string is created by calling the toExternalFile() method of the stream protocol handler for this object.

Syntax

Overrides

toString in class Object

Returns

A string representation of this object.

Example 1

Test it Now

Output:

The given url is : https://www.javatpoint.com/java-tutorial
User information of given url is : https://www.javatpoint.com/java-tutorial

Example 2

Output:

Given URL is : https://www.javatpoint.com/URL-class
 File name in given url : URL-class
Next TopicJava URL Class




Latest Courses