Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

import java.io.DataInputStream;
import java.net.URL;
import java.net.URLConnection;

public class Main {
    public static void main(String[] args) throws Exception {

        URL google = new URL("http://www.google.com/");
        URLConnection googleConnection = google.openConnection();
        DataInputStream dis = new DataInputStream(googleConnection.getInputStream());
        StringBuffer inputLine = new StringBuffer();
        String tmp;
        while ((tmp = dis.readLine()) != null) {
            inputLine.append(tmp);
            System.out.println(tmp);
        }
        // use inputLine.toString(); here it would have whole source
        dis.close();
    }
}