Java HttpURLConnection getFollowRedirects() Method

The getFollowRedirects() is the method of HttpURLConnection class. This method is used to indicate whether or not HTTP redirects (3xx) should be automatically followed.

Syntax

Returns

It returns true if HTTP redirects automatically followed else it returns false.

Example 1

Test it Now

Output:

getFollowRedirects : true
connecion disconnected

Example 2

Test it Now

Output:

getFollowRedirects :true
www.oracle.com
getFollowRedirects :true
connection disconnected




Latest Courses