I am able to write a java program to access a particular url , and get the data , but the data is in raw format and the complete source is printed in the terminal .

import java.net.*;
import java.io.*;

public class URLConnectionReader {
    public static void main(String[] args) throws Exception {
        URL go = new URL("http://www.google.com/");
        URLConnection uc = go.openConnection();

        BufferedReader in = new BufferedReader(
                                new InputStreamReader(
        String inputLine;

        while ((inputLine = in.readLine()) != null) 

I want that raw data to be displayed as a web page. Is there any way to do that.

Edited 3 Years Ago by mike_2000_17: Fixed formatting

I was trying to the code for displaying the url content. but its not showing that specific url. Its shows some html format. what is the format of creating the url connection and it will display that webpage content. for example i would give https://www.google.com it have to display or connect to the webpage of google. pls do the needful.

This article has been dead for over six months. Start a new discussion instead.