Advertisement
Guest User

Untitled

a guest
Jul 28th, 2014
194
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. import java.net.*;
  2. import java.io.*;
  3.  
  4. public class URLConnectionReader {
  5. public static void main(String[] args) throws Exception {
  6. URL yahoo = new URL("http://www.yahoo.com/");
  7. URLConnection yc = yahoo.openConnection();
  8. BufferedReader in = new BufferedReader(
  9. new InputStreamReader(
  10. yc.getInputStream()));
  11. String inputLine;
  12.  
  13. while ((inputLine = in.readLine()) != null)
  14. System.out.println(inputLine);
  15. in.close();
  16. }
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement