Javatpoint Logo
Javatpoint Logo

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: [email protected]fa

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





Youtube For Videos Join Our Youtube Channel: Join Now

Feedback


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA