//program to get host name by ip address
import java.net.*;
public class GetHostName {
public static void main(String args[]) throws Exception {
InetAddress inetAddress = InetAddress.getByName("8.8.8.8");
System.out.println("Host Name: " + inetAddress.getHostName());
}
}
Get Host Name by IP Address program in Java
Output: