Skip to content
Related Articles

Related Articles

Improve Article
Difference Between URL, URI and URN in Java
  • Last Updated : 12 Mar, 2021

URI stands for Uniform Resource Identifier.URI is a sequence of characters used to identify resource location or a name or both over the World Wide Web. A URI can be further classified as a locator, a name, or both.

Syntax of URI: Starts with a scheme followed by a colon character, and then by a scheme-specific part. 

The most popular URI schemes, are HTTP, HTTPS, and FTP.

URL stands for Uniform Resource Location.URL is a subset of URI that describes the network address or location where the source is available.URL begins with the name of the protocol to be used for accessing the resource and then specific resource location. URLs build on the Domain Name Service (DNS) to address hosts symbolically and use a file-path like syntax to identify specific resources at a given host. For this reason, mapping URLs to physical resources is straightforward and is implemented by various Web browsers.

URN stands for Uniform Resource Name. It is a URI that uses a URN scheme. 



“urn” scheme: It is followed by a namespace identifier, followed by a colon, followed by namespace specific string

URN does not imply the availability of the identified resource.URNs are location-independent resource identifiers and are designed to make it easy to map other namespaces into URN space.

NoURI URLURN
1URI stands for Uniform Resource IdentifierURL stands for Uniform Resource LocationURN stands for Uniform Resource Name
2URI is a superset of URL & URNURL is a subset of the Uniform ResourceURN  is a subset of the Uniform Resource. 
3It used to identify a resource on the internet either by location or a name or bothIt is used to identify a resource on the internet either by location It uniquely identifies the resource by name
4URI is not always a URLAll URLs are URIsAll URNs are URIs
5URI includes components like scheme, authority, path, query, etc.URL includes protocol,domain,path,hash,query,string etcURN does not include any component
6

Example:

https://www.geeksforgeeks.org/setting-environment-java/?ref=lbp

Example:

https%3A%2F%2Fwww.geeksforgeeks.org%2Fsetting-environment-java%2F%3Fref%3Dlbp

Example:

setting up the environment in java

Here is a diagram that shows the relationship between URL, URI, URN:

Attention reader! Don’t stop learning now. Get hold of all the important Java Foundation and Collections concepts with the Fundamentals of Java and Java Collections Course at a student-friendly price and become industry ready. To complete your preparation from learning a language to DS Algo and many more,  please refer Complete Interview Preparation Course.

My Personal Notes arrow_drop_up
Recommended Articles
Page :