How to check if an URL is valid or not using Java?

Posted by Editorial Staff | Updated on

In this answer, we have shared how to check if an URL is valid or not using Java? We have used toURI() method to validate URL, If the current URL is not properly formatted or, syntactically incorrect according to RFC 2396 this method throws a URISyntaxException.

Program Output


If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.

Related Questions & Answers