import java.io.InputStream; import java.net.HttpURLConnection; import java.net.URL; public class Main { public static void main(String args[]) throws Exception { URL url = new URL("http://www.google.com"); HttpURLConnection httpCon = (HttpURLConnection) url.openConnection(); InputStream inStrm = httpCon.getInputStream(); System.out.println("\nContent at " + url); int ch; while (((ch = inStrm.read()) != -1)) System.out.print((char) ch); inStrm.close(); } }