URLConnection is required to play with the contents of the web page. Following code snippet opens URLConnection for the given website.
|
Code:
|
try {
URL u = new URL("http://www.cricinfo.com/");
URLConnection uc = u.openConnection( );
}
catch (MalformedURLException ex) {
System.err.println(ex);
}
catch (IOException ex) {
System.err.println(ex);
} |