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
b
Explanation: None.
Output:
$ javac networking.java
$ java networking
127