654). Which of these class is used to access actual bits or content information of a URL?

[A]URL
[B]URLDecoder
[C]URLConnection
[D]All of the mentioned

Show Answer

655). What will be the output of the following Java code?
    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.getProtocol());
        }
    }

[A]http
[B]https
[C]www
[D]com

Show Answer

656). What will be the output of the following Java program?
    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.getPort());
        }
    }

[A]1
[B]0
[C]-1
[D]garbage value

Show Answer

657). What will be the output of the following Java program?
    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.getHost());
        }
    }

[A]sanfoundry
[B]sanfoundry.com
[C] www.sanfoundry.com
[D] https://www.sanfoundry.com/javamcq

Show Answer

658). What will be the output of the following Java program?
    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]www.sanfoundry.com
[D]https://www.sanfoundry.com/javamcq

Show Answer