Question: Write a Java program that takes a URL and renders the following output about the URL ( hint: look at the API documentation for URL

Write a Java program that takes a URL and renders the following output about the URL (hint: look at the API documentation for URL). Make sure I can test with different URLs.Print the default port for the protocol if no specific port is provided in the URL. Please explain why you are coding the program the way you are, I am confused about this assignment.
Output should be something like-
Properties for URL: ...
Protocol: ...
Host: ...
Port: ...
File: ...

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!