Skip to content
Advertisement

How to verify if a String in Java is a valid URL?

How to verify if a String in Java is a valid URL?

Advertisement

Answer

You can try to create a java.net.URL object out of it. If it is not a proper URL, a MalformedURLException will be thrown.

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement