I was looking up sample codes that were previously written by colleague who left the firm. But am not able to understand what does defining a method with an Abstract class name achieve
This is the import statement
import java.net.HttpURLConnection;
And there is a method written as
private static HttpURLConnection pullData(url, redirects) throws IOException
try
{
String method = "GET";
HttpURLConnection connection = null;
connection = (HttpURLConnection) url.openConnection();
connection.setRequestMethod(method);
connection.setInstanceFollowRedirects(false);
int statusCode = connection.getResponseCode();
if (statusCode == 301) {
if (redirects == 0) {
throw new IOException("Stop!");
}
connection.disconnect();
return pullData(url, redirects - 1);
}
catch (IOException ioerror) {
if (connection != null) {
connection.disconnect();
}
throw ioerror;
}
return connection;
}
Now i was reading up on HttpURLConnection on https://docs.oracle.com/javase/8/docs/api/java/net/HttpURLConnection.html and noticed it is an abstract class. But have not understood what does defining a method with that class name achieves. Is it supposed to be like a data type?
Basically what does private static HttpURLConnection <methodname>
do?