What will be the output of the following Java program?

import java.net.*;
class networking 
{
    public static void main(String[] args) throws Exception 
    {
        URL obj = new URL("https://www.sanfoundry.com/javamcq");
        URLConnection obj1 = obj.openConnection();
        int len = obj1.getContentLength();
        System.out.print(len);
    }
}

Note: Host URL is having length of content 127.
a) 126
b) 127
c) Compilation Error
d) Runtime Error

1 thought on “What will be the output of the following Java program?”

Leave a Comment