Live quiz

java - Part 73

Question 1 of 25 Hints left: 3
Q1

What will be the output of the following Java program? import java.io.*; import java.net.*; public class URLDemo { public static void main(String[] args) { try { URL url=new URL("https://www.example.com/java-mcq"); System.out.println("Protocol: "+url.getProtocol()); System.out.println("Host Name: "+url.getHost()); System.out.println("Port Number: "+url.getPort()); } catch(Exception e){System.out.println(e);} } }

  • A
  • B
  • C
  • D