Which method is used to retrieve the protocol type of a URL in Java?

  • fetchProtocol()
  • getProtocol()
  • getURLProtocol()
  • retrieveProtocol()
In Java, to retrieve the protocol type of a URL, you should use the getProtocol() method of the URL class. It returns a String containing the protocol, such as "http," "https," "ftp," etc. The other options do not exist as valid methods for this purpose.
Add your answer
Loading...

Leave a comment

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