开启URL的三种方法

来源:互联网 发布:omnigraffle for mac 编辑:程序博客网 时间:2024/06/04 18:42
   // 方法一 
           URL url = new URL("http://www.sina.com.cn");
           URLConnection urlcon = url.openConnection();
           InputStream is = urlcon.getInputStream();
          
            // 方法二
           URL url = new URL("http://www.yhfund.com.cn");
           HttpURLConnection urlcon = (HttpURLConnection)url.openConnection();
           InputStream is = urlcon.getInputStream();
          
           //方法三
           URL url = new URL("http://www.yhfund.com.cn");
           InputStream is = url.openStream();
0 0
原创粉丝点击