1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.net.URL; import java.net.URLConnection; public class ConnectionURL { public static void main(String[] args) throws IOException { URL url = new URL("http://www.jesusninoc.com"); String inputLine; URLConnection hc = url.openConnection(); BufferedReader br = new BufferedReader(new InputStreamReader(hc.getInputStream())); while ((inputLine = br.readLine()) != null) { System.out.println(inputLine); } br.close(); } } |