Languages
[Edit]
EN

Java - get domain name from given url

3 points
Created by:
Argon
617

In this article, we would like to show how to get a domain from a given URL in Java.

Quick solution:

 

Practical example

Edit

In this section, the code was split to provide reusable DomainUtil class.

Program.java file:

Example output:

 

DomainUtil.java file:

1
Donate to Dirask
Our content is created by volunteers - like Wikipedia. If you think, the things we do are good, donate us. Thanks!
Join to our subscribers to be up to date with content, news and offers.
Native Advertising
🚀
Get your tech brand or product in front of software developers.
For more information Contact us
Dirask - we help you to
solve coding problems.
Ask question.

❤️💻 🙂

Join