import java.net.URL; import java.net.URLConnection; import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.IOException; public class ShowURL { 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; while ((buf = reader.readLine()) != null) { System.out.println(buf); buf = reader.readLine(); } // while } // try catch (java.net.MalformedURLException e) { System.out.println("Fel på webbadressen"); } catch (java.io.IOException e) { System.out.println("Fel när webbsidan skulle hämtas"); } } // main } // ShowURL