URLConnection
时间: 2023-08-20 08:11:56 浏览: 90
URLConnection是一个抽象类,而HttpURLConnection是URLConnection的一个子类。\[1\]在Java中,我们可以通过URL.openConnection()方法来获取一个HttpURLConnection的实例。\[2\]HttpURLConnection是用于进行HTTP连接的类,它提供了一些特定于HTTP协议的方法和属性,例如请求方法、响应码等。\[5.1\]通过HttpURLConnection,我们可以发送HTTP请求并获取服务器的响应。\[3\]所以,引入HttpURLConnection是为了更方便地进行HTTP连接和通信。
#### 引用[.reference_title]
- *1* *2* [URLConnection-URL连接](https://blog.csdn.net/PacosonSWJTU/article/details/121171229)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^koosearch_v1,239^v4^insert_chatgpt"}} ] [.reference_item]
- *3* [URLConnection类详解](https://blog.csdn.net/weixin_30487317/article/details/99908981)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^koosearch_v1,239^v4^insert_chatgpt"}} ] [.reference_item]
[ .reference_list ]
阅读全文