import java.net.URL;
import java.net.URLConnection;
import java.util.Scanner;
public class Test {
public static void main(String[] args) throws Exception {
URL url = new URL("http://info.cern.ch/");
URLConnection con = url.openConnection();
Scanner sc = new Scanner(con.getInputStream());
while(sc.hasNext()){
System.out.print(sc.nextLine());
}
sc.close();
}
}
URL url = new URL("http://www.baidu.com");
Scanner scanner = new Scanner((InputStream) url.getContent());
while(scanner.hasNext()){
System.out.println(scanner.next());
}