Class HighLite InetAddress

What I try to do in this Class HighLite series is to bring to focus a single class which I have found very useful but which I don’t use often enough. That almost sounds like a paradox but it is not and InetAddress will prove it. Please note that in when in doubt read the Java documentation, as it is the best available source of information on the Java API.

InetAddress net = InetAddress.getLocalHost();
String hostName = net.getHostName();

Once you have created an InetAddress object, I have found the getHostName the most useful. The getHostName, as you may imagine, returns the host name of the computer executing that line of code. You can use this, for example, in an about dialog box along with the software version and available resources.