Java URL equals() Method

The equals() method of URL class compares this URL for equality with another URL object. It returns false if the given object is not a URL. If IP address of two different is same, then it considered equivalent host.

Syntax

Overrides

equals in class Object

Parameter

obj - the URL to compare against.

Returns

true if the objects are the same; false otherwise.

Example 1

Test it Now

Output:

Matching url : true
Next TopicJava URL Class




Latest Courses