URI uri = new URI("https://example.com/path/to/resource?query_param=value"); String authority = uri.getAuthority(); System.out.println(authority); // output: example.com
URI uri = new URI("file:///home/user/documents/index.html"); String authority = uri.getAuthority(); System.out.println(authority); // output: nullIn this example, we create a URI object with a file URI and use the getAuthority() method to extract the authority component. Since file URIs do not have an authority, the value returned by getAuthority() is null. Package library: java.net