-
What is the output of this program?
import java.net.*;
public class Networking_Port
{
public static void main(String[] args) throws MalformedURLException
{
URL object = new URL("https://www.interviewmania.com/programming");
System.out.print(object.getPort());
}
}
-
- garbage value
- 1
- -1
- 0
- None of these
Correct Option: C
Since we have not explicitly set the port default value that is -1 is printed.