Java URL getContent() Method

The getContent() Method of URL gets the contents of this URL. This method is a shorthand for openConnection().getContent().

Syntax

Returns

The contents of this URL.

Throw

IOException - if an I/O exception occurs.

Example 1

Test it Now

Output:

Given Url is : https://www.javatpoint.com/
The content of given url is: sun.net.www.protocol.http.HttpURLConnection$HttpInputStream@feb3fa

Example 2

Test it Now

Output:

sun.net.www.protocol.http.HttpURLConnection$HttpInputStream
The mime type is : text/html; charset=iso-8859-1
Next TopicJava URL Class




Latest Courses