import java.io.*; import java.net.*; class DownloadHtml { public static void main(String[] args) throws IOException { if(args.length!=1) { System.out.println("This program downloads the homepage at the URL\n" +"given as parameter and writes its content to the screen."); return; } URL url=new URL(args[0]); BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream())); while(true) { String line=in.readLine(); if(line==null) break; System.out.println(line); } in.close(); } }