The ________ method of URL class provides the port number of the URL.

  • fetchPortNumber()
  • getPort()
  • obtainPort()
  • retrievePort()
The correct answer is getPort(). In Java, the URL class provides the getPort() method, which allows you to obtain the port number of a URL. This is useful when working with network-related tasks where you need to know the port associated with a particular URL.
Add your answer
Loading...

Leave a comment

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