Which Java method is used to establish a connection to a specified URL?
- URLConnect()
- connectToURL()
- establishConnection()
- openConnection()
To establish a connection to a specified URL in Java, you use the openConnection() method provided by the URL class. This method returns a URLConnection object, which can be used to interact with the resource located at the URL.
Loading...
Related Quiz
- What is the impact on memory usage when declaring a large two-dimensional array with most elements being zero?
- Which method needs to be overridden to define the task of a thread?
- The statement that is used to create an exception object and hand it off to the runtime system is called ________.
- Which keyword is used in Java to test a condition?
- The method replace(oldChar, newChar) belongs to the ________ class in Java.