How can you get the local host address using the `InetAddress` class in Java?
You can use the `InetAddress.getLocalHost()` method, but it only works if the network is set up correctly.
Thatâ€™s incorrect. The method works as long as the local machine can resolve its host name, and it doesnâ€™t depend on specific network configurations.
Could you explain why `getLocalHost()` might throw an exception in certain cases?