import java.net.URL; import java.net.URLConnection; import java.net.MalformedURLException; import java.io.InputStreamReader; import java.io.BufferedReader; import java.io.IOException; class Program01 { public static void main(String args[]) { InputStreamReader stream = null; BufferedReader reader = null; try { URL url = new URL("http://szit.hu"); URLConnection con = url.openConnection(); stream = new InputStreamReader(con.getInputStream()); reader = new BufferedReader(stream); System.out.println(reader.readLine()); System.out.println(reader.readLine()); }catch(MalformedURLException e) { System.out.println("Hibás URL"); }catch(IOException e) { System.out.println("Hiba a kapcsolatban"); }finally { try{ reader.close(); stream.close(); }catch(IOException e){} } } }