import java.net.URL; import java.net.URLConnection; import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.IOException; class url_c { public static void main( String args[] ) { try { URL yahoo_url = new URL( "http://www.yahoo.com" ); URLConnection yahoo_conn = yahoo_url.openConnection(); BufferedReader reader = new BufferedReader( new InputStreamReader( yahoo_conn.getInputStream() ) ); String buf = reader.readLine(); while ( buf != null ) { System.out.println( buf ); buf = reader.readLine(); } // while reader.close(); } // try catch ( java.net.MalformedURLException exc ) { System.out.println( "Fel på WEB-adressen" ); } // java.net.MalformedURLException catch ( java.io.IOException exc ) { System.out.println( "Fel vid getInputStream" ); } // IOException } // main } // url_c