// ReadFromWeb Example // Source code file ReadFromWeb.java // Read raw HTML lines from input file and // print them to stdout. import java.io.IOException; import java.io.InputStream; import java.net.MalformedURLException; import java.net.URL; import java.util.Scanner; public class ReadFromWeb { public static void main(String[] args) throws MalformedURLException, IOException { String urlString = "http://facweb.cdm.depaul.edu/sjost/it313/greeting.htm"; // Create Scanner object that reads from a Web URL. InputStream s = new URL(urlString).openStream( ); Scanner in = new Scanner(s); while (in.hasNextLine( )) { String line = in.nextLine( ); System.out.println(line); } in.close( ); } }