Comment Comment by pcdavid This is not representattive of modern Java, which has much better APIs. Since Java 11: public HttpResponse<String> fetch(String url) { HttpClient client = HttpClient.newHttpClient(); HttpRequest request = HttpRequest.newBuilder(URI.create(url)).build(); return client.send(request, BodyHandlers.ofString()); } parent pcdavid 4 years ago