Online Java Compiler By
JavaTpoint.com
import java.io.*; import java.net.*; public class URLopenConnectionExample2 { public static void main(String[] args) { try { URL url = new URL("https://www.javatpoint.com/java-jdbc"); URLConnection urlcon=url.openConnection(); System.out.println("---------------------------------"); //get the inputstream of the open connection. BufferedReader br = new BufferedReader(new InputStreamReader (urlcon.getInputStream())); String i; while ((i = br.readLine()) != null) { System.out.println(i); } } catch (Exception e) { System.out.println(e); } } }
Output