java.net.URL method of URL class represents a URL & has complete set of methods

Q.  Which method of URL class represents a URL and it has complete set of methods to manipulate URL in Java?
- Published on 15 Jul 15

a. java.net.URL
b. java.net.URLConnection
c. Both A & B
d. None of the above

ANSWER: java.net.URL
 

    Discussion

  • Prajakta Pandit   -Posted on 15 Dec 15

    - java.net.URL method represents a URL and it has complete set of methods to manipulate the URL in Java.

    - It has the following constructors for creating the URL,

    1. public URLStringprotocol, Stringhost, intport, Stringfile throws MalformedURLException.
    2. public URLStringprotocol, Stringhost, Stringfile throws MalformedURLException
    3. public URLStringurl throws MalformedURLException
    4. public URLContext, Stringurl throws MalformedURLException

    - It demonstrates the various parts of a URL.

Post your comment / Share knowledge


Enter the code shown above:

(Note: If you cannot read the numbers in the above image, reload the page to generate a new one.)