Online Java Compiler By
JavaTpoint.com
import java.net.URL; import java.net.URLConnection; import java.util.Scanner; public class URLgetAuthorityExample2 { public static void main(String args[]) throws Exception { URL url = new URL("http://www.javatpoint.com"); URLConnection connection = url.openConnection( ); String mimeType = connection.getContentType( ); Object contents = url.getAuthority(); System.out.println("Url Authority : "+ contents); System.out.println(" The mime type is : "+mimeType); } }
Output