import java.net.*; class networking { public static void main(String[] args) throws MalformedURLException { URL obj = new URL("https://www.sanfoundry.com/javamcq"); System.out.print(obj.toExternalForm()); } }
a) sanfoundry
b) sanfoundry.com
c) http://www.sanfoundry.com
d) https://www.sanfoundry.com/javamcq
d
Explanation: toExternalForm() is used to know the full URL of an URL object.
Output:
$ javac networking.java
$ java networking
https://www.sanfoundry.com/javamcq