The ________ method of HttpURLConnection class is used to make the connection to the remote object referred by the URL.
- connect()
- createConnection()
- makeConnection()
- openConnection()
To make a connection to the remote object referred to by a URL using HttpURLConnection, you use the openConnection() method. This method initializes and opens a connection to the specified URL. The other options are not standard methods for this purpose.
Loading...
Related Quiz
- What is the key difference between the poll() and remove() methods when used with a Queue in Java?
- How do you specify a timeout while trying to connect to a remote socket?
- How does Java manage the memory allocation of primitive and reference data types in the stack and heap?
- Consider a scenario where you want to invert the sign of a numeric value only if a particular boolean condition is true. How can unary operators be utilized to achieve this without using an if statement?
- What happens if no constructor is provided in a Java class?