URLConnection

 avatar
Rohit143
java
2 years ago
412 B
15
Indexable
Never
import java.net.*;
import java.io.*;
public class urlconnection {
    public static void main(String[] args) throws Exception {
        URL url = new URL("https://www.google.com");
        URLConnection con =url.openConnection();
        InputStream stream = con.getInputStream();
        int i;
        while ((i=stream.read())!=-1) {
            System.out.print((char)i);
        }
    }
    
}