import java.net.*; import java.io.*; public class URLReader { public static void main(String[] args) throws Exception { URL yahoo = new URL("http://www.yahoo.com/"); BufferedReader in = new BufferedReader( new InputStreamReader( yahoo.openStream())); String inputLine; while ((inputLine = in.readLine()) != null) System.out.println(inputLine); in.close(); } }
$ javac URLReader.java $ java URLReader or java -cp . URLReader
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)