You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
10 lines
375 B
Java
10 lines
375 B
Java
import java.net.InetAddress;
|
|
public class Main {
|
|
public static void main(String[] args)
|
|
throws Exception {
|
|
InetAddress addr = InetAddress.getLocalHost();
|
|
System.out.println("Local HostAddress: "+addr.getHostAddress());
|
|
String hostname = addr.getHostName();
|
|
System.out.println("Local host name: "+hostname);
|
|
}
|
|
} |