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.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *