集册 Java实例教程 获取Http URL连接

获取Http URL连接

欢马劈雪     最近更新时间:2020-01-02 10:19:05

561
获取Http URL连接


//package com.nowjava;


import java.io.IOException;
/*来自 
 NowJava.com*/


import java.net.HttpURLConnection;

import java.net.URL;


public class Main {

    public static void main(String[] argv) throws Exception {

        String strUrl = "nowjava.com";

        System.out.println(getHttpURLConnection(strUrl));

    }

    /**
     from
    * 时代Java - nowjava.com 
    **/

    public static HttpURLConnection getHttpURLConnection(String strUrl)

            throws IOException {

        URL url = new URL(strUrl);

      
展开阅读全文