Post usefull Java codes for everyones benefit.For Java programmers.

@raghwagh (1527)
India
December 11, 2006 12:35pm CST
There are very few programming related discusions.I think every programmer should start good programming discussions.Also we can put discussions on Programming problems and solutions for the same.You can put the java related problems and I will try to solve them. Here I am putting a small code which can read the HTML page from a web site. //URL.java import java.net.*; import java.util.*. class URL{ public static void main(String[] args) { String line1=""; try{ URL u = new URL(link);//Thi is the link you want to read eg.http://www.yahoo.com InputStream is = u.openStream(); InputStreamReader isr = new InputStreamReader(is); BufferedReader br = new BufferedReader(isr); String line; while((line=br.readLine())!=null) { if(!line.equals("")) line1=line1 + line +"\n"; } }catch(Exception e){System.out.println("inreadurl");e.printStackTrace(); } System.out.println(line1); } } Try this code.
No responses