Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.URL;

public class Main {
    public static void main(String[] args) throws Exception {
        URL myURL = new URL("http://www.google.com");
        BufferedReader so = new BufferedReader(new InputStreamReader(myURL.openStream()));
        while (true) {
            String output = so.readLine();
            if (output != null) {
                System.out.println(output);
            } else {
                break;
            }
        }
        so.close();
    }
}