Question
Note: Host URL is having length of content 127.
import java.net.*;
class networking
{
public static void main(String[] args) throws Exception
{
URL obj = new URL("https://www.compscibits.com/");
URLConnection obj1 = obj.openConnection();
int len = obj1.getContentLength();
System.out.print(len);
}
}
a.
126
b.
127
c.
Compilation Error
d.
Runtime Error
Posted under Java Programming
Engage with the Community - Add Your Comment
Confused About the Answer? Ask for Details Here.
Know the Explanation? Add it Here.
Q. What is the output of this program? Note: Host URL is having length of content 127.
Similar Questions
Discover Related MCQs
Q. Which of these method is used to start a server thread?
View solution
Q. Which of these method is called when http daemon is acting like a normal web server?
View solution
Q. What does URL stands for?
View solution
Q. Which of these exceptions is thrown by URL class’s constructors?
View solution
Q. Which of these methods is used to know host of an URL?
View solution
Q. Which of these methods is used to know the full URL of an URL object?
View solution
Q. Which of these class is used to access actual bits or content information of a URL?
View solution
Q. Which of these is a wrapper around everything associated with a reply from an http server?
View solution
Q. Which of these transfer protocol must be used so that URL can be accessed by URLConnection class object?
View solution
Q. Which of these methods is used to know when was the URL last modified?
View solution
Q. Which of these methods is used to know the type of content used in the URL?
View solution
Q. Which of these data member of HttpResponse class is used to store the response from an http server?
View solution
Q. Which of these is a bundle of information passed between machines?
View solution
Q. Which of these class is necessary to implement datagrams?
View solution
Q. Which of these method of DatagramPacket is used to find the port number?
View solution
Q. Which of these method of DatagramPacket is used to obtain the byte array of data contained in a datagram?
View solution
Q. Which of these methods of DatagramPacket is used to find the length of byte array?
View solution
Q. Which of these class must be used to send a datagram packets over a connection?
View solution
Q. Which of these method of DatagramPacket class is used to find the destination address?
View solution
Q. Which of these is a return type of getAddress() method of DatagramPacket class?
View solution
Suggested Topics
Are you eager to expand your knowledge beyond Java Programming? We've curated a selection of related categories that you might find intriguing.
Click on the categories below to discover a wealth of MCQs and enrich your understanding of Computer Science. Happy exploring!