URIs, URLs, and urns
First, the URI, which is the Uniform Resource identifier, is the Uniform Resource identifier used to uniquely identify a resource. The URL is a Uniform Resource Locator, a Uniform Resource locator, which is a specific URI that the URL can use to identify a resource and also how to locate the resource. and Urn,uniform resource Name, unified resource naming, is the name to identify resources, such as Mailto:[email protected]. That is, URIs define uniform resource identities in an abstract, high-level concept, whereas URLs and urns are specific resource identities. URLs and urns are all a kind of URI.
In the Java URI, a URI instance can represent absolute or relative, as long as it conforms to the syntax rules of the URI. The URL class not only conforms to semantics, but also contains information that locates the resource, so it cannot be relative, and the schema must be specified.
The difference between a URI and a URL