Online Java Compiler By
JavaTpoint.com
import java.io.*; import java.net.*; class URLGetRefExample1 { public static void main(String args[]) throws Exception { URL url = new URL("https://docs.oracle.com/javase/9/docs/api/java/net/URL.html#getRef--"); URLConnection connection = url.openConnection( ); String mimeType = connection.getContentType( ); Object contents = url.getRef(); System.out.println("Url reference is : "+ contents); System.out.println("The mime type is : "+mimeType); } }
Output