Javatpoint Logo
Javatpoint Logo

Java URL getPath() Method

The 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.

Syntax

Returns

The path part of this URL, or an empty string if one does not exist

Since

1.3

Example 1

Output:

Url: https://www.javatpoint.com/collections-in-java#collectionmethods
Path of File in given url is : /collections-in-java

Example 2

Test it Now

Output:

Given URL is : https://localhost/notic/note.jsp
Path of url is : /notic/note.jsp
Next TopicJava URL Class





Youtube For Videos Join Our Youtube Channel: Join Now

Feedback


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA