ckinan
3/9/2018 - 10:10 PM

Print hostname of server

Print hostname of server

import java.net.InetAddress;
import java.net.UnknownHostException;

public class NetworkTest {

    public static void main(String[] args) throws UnknownHostException {
        System.out.println(InetAddress.getLocalHost().getHostName());
    }
    
}