What is the role of a URLConnection object in the context of network programming in Java?

  • To create a new URL instance
  • To establish a connection to a remote resource
  • To generate random URLs for testing purposes
  • To retrieve data from a local file
The primary role of a URLConnection object in Java network programming is to establish a connection to a remote resource, typically through a URL. It allows you to read from and write to that resource, making it a fundamental component of networking tasks. The other options do not accurately represent the role of a URLConnection object.
Add your answer
Loading...

Leave a comment

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