Java URL sameFile MethodThe sameFile() method of URL class compares two URLs, excluding the fragment component. It returns true if this URL and the other argument are equal without considering the fragment component. SyntaxParameterother - the URL to compare against. Returnstrue if they reference the same remote object; false otherwise. Example 1Output: Url1 : https://www.javatpoint.com/aptitude/quantitative Url2 : https://www.javatpoint.com/ ***** compareing both url ***** Both url has different file Example 2Output: Enter any url https://www.javatpoint.com/ File of Both url are equal : true Example 3Output: Both BaseUrl and relativeURL are equal? : false Next TopicJava URL Class |
We provides tutorials and interview questions of all technology like java tutorial, android, java frameworks
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India