What will be the output of the following Java program?
Note: Host URL is written in html and simple text.
import java.net.*;
class networking
{
public static void main(String[] args) throws Exception
{
URL obj = new URL("https://www.example.com/javamcq");
URLConnection obj1 = obj.openConnection();
System.out.print(obj1.getContentType());
}
}
import java.net.*;
class networking
{
public static void main(String[] args) throws Exception
{
URL obj = new URL("https://www.example.com/javamcq");
URLConnection obj1 = obj.openConnection();
System.out.print(obj1.getContentType());
}
}
A. html
B. text
C. html/text
D. text/html
Answer: Option D
Join The Discussion