To render a web page, use:
import java.net.URL;
import java.net.URLConnection;
import java.io.InputStream;
import java.io.BufferedReader;
import java.io.InputStreamReader;
public class Main{
public static void main(String[] args){
try{
URL google = new URL("http://google.com");
URLConnection conn = google.openConnection();
InputStream input = conn.getInputStream();
BufferedReader reader = new BufferedReader(input);
String text = "";
while(text!=null){
text = reader.readLine();
System.out.println(text);
}
}
}
}
No comments:
Post a Comment