Difference Between URI and URN in Java
URI stands for Uniform Resource Identifier. It identifies the resource either by name, or by location, or by both. It allows uniform identification of the resources. Here the resource can be anything like documents, images, files, web pages, etc. that can be part of the web architecture. The identifier in the name URI refers to the prominence of the resources, despite the technique used.
When you are browsing on the internet, you are actually looking up a bundle of web resources. We use the Uniform resource identifiers to define the location of a resource. A URI consists of two things: URL and URN.
URN stands for Uniform Resource Name. It identifies the resources by name in a given name-space. A name-space refers to a group of names or identifiers. It is a subset of URI. URN does not include any protocol. A URN is required to exist globally unique and features global scopes. A URN is an unambiguous way to identify a resource.
Difference Between URI and URN
|It is the superset of URL and URN.||It is the subset of URI.|
|It identifies the recourse by name, location, or both.||It identifies the resource by names.|
|URI is used to distinguish one resource from others regardless of the method used.||URN is used to distinguish one resource from others by the globally unique names.|
The above example line completely is referred to as URI whereas the part “www.website.com/html/#posts” of the above example is referred to as a 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.