programming-examples/java/Numerical_Problems/java program to find hostname from IP Address.java

8 lines
335 B
Java
Raw Normal View History

2019-11-15 12:59:38 +01:00
import java.net.InetAddress;
public class Main {
public static void main(String[] argv) throws Exception {
InetAddress addr = InetAddress.getByName("23.229.203.68");
System.out.println("Host name is: "+addr.getHostName());
System.out.println("Ip address is: "+ addr.getHostAddress());
}
}