Saturday, March 5, 2011

Java - Getting Computer Name


public class GetComputerName {

    public static void main(String args[]) {
        try {
            String computerName = InetAddress.getLocalHost().getHostName();
            System.out.println(computerName);
        } catch (Exception e) {
            System.out.println("Exception caught =" + e.getMessage());
        }
    }
}

0 comments:

Post a Comment

Contact Form

Name

Email *

Message *

The Insane Techie - Android App

Launched an android app for the blog on 07th June 2016. Get it from google play store... Tips for using the app Use in landscape mo...