Content types are used to inform the kind of file that is being transmitted over the Web. Few examples of content types are: text/plain, text/html, image/jpeg, video/quicktime etc.

Following code gets content type from a web:

Java Code:
URL u = new URL("");
URLConnection uc = u.openConnection( );
System.out.println("Content-type: " + uc.getContentType( ));
Java Code:
Content-type: text/html; charset=utf-8