URI / URL is limited. To be valid, it must follow a specific format.
Saying that they accept only URI / URL methods, they say that the string they accept should be in this format. It also makes it easier to understand at a glance what the method expects (URL), and not potentially any String.
If the string is not in this format, it is detected immediately when you try to create a URL object, and not at some unknown point in the future when you try to use this URL in the method.
Thus, by doing this, it improves type safety, makes the code more readable, and leads to crashes that may occur closer to the root cause of the failure, and not to some unknown point in the future.
You also get methods for correctly creating a URL from its parts, for opening resources using a URL, etc. So this is much more than just a string. Take a look at Javadoc to find out how many methods it provides:
http://docs.oracle.com/javase/7/docs/api/java/net/URL.html
source share