Java URL getPath() MethodThe getPath() method of URL class is used to get the path part of this URL. It returns an empty string if one does not exist. SyntaxReturnsThe path part of this URL, or an empty string if one does not exist Since1.3 Example 1Output: Url: https://www.javatpoint.com/collections-in-java#collectionmethods Path of File in given url is : /collections-in-java Example 2Test it NowOutput: Given URL is : https://localhost/notic/note.jsp Path of url is : /notic/note.jsp
Next TopicJava URL Class
|