1 public class MyIpAddress{
2 public static void main(String[] args) {
3 java.net.InetAddress ip = java.net.IpAddress.getLocalHost();
4 System.out.println(ip);
5 String hostName = ip.getHostName();
6 System.out.println("Host name: " + hostName);
7 }
8 }
And there you have it; the Computers ipaddress and the hostname.
No comments:
Post a Comment
Your suggestion counts...