Here we are going to explore a method to retrieve the host name of the local system in a very simple example. Here we are just call the InetAddress class and after made a object of that class we call a getLocalHost() method and pass it in the object.
In this way we find out the ip address of the local system in a very simple manner. the complete code of the example is as under.
Here is the Code of the Example :
The above example shows the host name of the local system. The output of the above example is as under, where the local hostname shows as comp20.
Here is the Output of the Example :
Local hostname is: comp20
Rs. 20,000 US$ 300
Today: Rs. 10,000 US$150
Course Duration: 30 hrs
Posted on: June 16, 2009 If you enjoyed this post then why not add us on Google+? Add us to your Circles