本文介绍了URLConnection.openConnection()和URLConnection.connect()之间的区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在code:
HttpURLConnection的连接=(HttpURLConnection类)createMerchURL.openConnection();
connection.setRequestMethod(PUT);
connection.addRequestProperty(姓名,值1);connection.connect();..
connection.disconnect();
-
在该连接越来越竟开?在
.. createMerchURL.openConnection();
?或者在connection.connect();
-
如何在
连接
对象设定网址和使用connection.connect()
?(因为我与.openConnection不太舒服()
)
最后,是两者之间有什么区别呢?
谢谢..
解决方案
The latter. The former just parses the URL, finds the protocol, and creates the HttpURLConnection
object.
You can't.
You can't.
Bad luck: get comfy with it.
这篇关于URLConnection.openConnection()和URLConnection.connect()之间的区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!