When working with networking applications in Java, we might encounter scenarios where we need to resolve the IP address of…