import javax.net.ssl.HttpsURLConnection;
import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
public class Http {
public final static void main(String[] args) throws Exception {
URL myurl = new URL("https://de.wikipedia.org/wiki/Test");
HttpsURLConnection con = (HttpsURLConnection) myurl.openConnection();
con.setRequestProperty("User-Agent",
con.connect();
if (con.getResponseCode() != HttpURLConnection.HTTP_OK) {
return;
}
InputStream ins = con.getInputStream();
BufferedReader in = new BufferedReader(new InputStreamReader(ins));
String inputLine;
while ((inputLine = in.readLine()) != null) {
System.out.println(inputLine);
}
in.close();
}
}