本文介绍了HttpURLConnection:是否有必要调用connect()?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我看到的许多示例没有显式调用

Are there any cases where connect() must be explicitly called for an HttpURLConnection?

推荐答案

不,没有情况。它隐含地按需执行。它甚至在文档中指定。以下是 javadoc:

No, there are no cases. It's implicitly executed on demand. It's even specified in the documentation. Here's an extract of the URLConnection#connect() javadoc:

这篇关于HttpURLConnection:是否有必要调用connect()?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-29 14:07
查看更多