15 lines
426 B
Java
Raw Normal View History

2015-05-05 11:20:13 -07:00
//: network/WhoAmI.java
2015-05-29 14:18:51 -07:00
// <20>2015 MindView LLC: see Copyright.txt
2015-05-31 18:34:12 -07:00
// Finds out your machine name and network address
// when you're connected to the Internet.
2015-05-05 11:20:13 -07:00
import java.net.*;
public class WhoAmI {
2015-05-31 18:34:12 -07:00
public static void main(String[] args)
2015-05-05 11:20:13 -07:00
throws Exception {
2015-05-31 18:34:12 -07:00
InetAddress whoami = InetAddress.getLocalHost();
System.out.println(whoami.getHostName());
System.out.println(whoami.getHostAddress());
2015-05-05 11:20:13 -07:00
}
} ///:~