a java program to read the webpage from a website and display the contents from the web page
Aim: Write a java program to read the webpage from a website and display the contents from the web page .
Program:
import java.net.*;
import java.io.*;
class Print
{
public static void
main(String args[])
{
try
{
URL
X=new URL("file:///E:/3it1212/web.html");
BufferedReader br=new BufferedReader(new
InputStreamReader(X.openStream()));
String
str;
while((str=br.readLine())!=null)
{
System.out.println(" "+str);
}
br.close();
}
catch(Exception e)
{
System.out.println("Exception Caught");
}
}
}
Output:
Labels: Advanced Java Lab
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home